Salesforce REST APIs – From Zero to Cloud to Local Dev in Minutes

When getting acquainted with new technologies I believe that users shouldn’t have to spend more than 15 minutes getting something simple up and running. I wanted to apply this idea to building an app on the Salesforce REST APIs so I built Quick Force (Node). In about 12 minutes you can deploy a Node.js app on Heroku that uses the Salesforce REST APIs, setup OAuth, then pull the app down to your local machine, make and test changes, and then redeploy those changes. Check out a video walkthrough:

Ok, now give it a try yourself by following the instructions in Quick Force (Node)!

I hope this will be the quickest and easiest way you’ve gotten started with the Salesforce REST APIs. Let me know how it goes!

FYI: This *should* work on Windows but I haven’t tested it there yet. So if you have any problems please let me know.

  • Pingback: Quick Force Java – Getting Started with Salesforce REST in Java – James Ward()

  • It’s really helpful and now I could create the Python version of the app.
    https://github.com/zaki-yama/quick-force-python

    I really appreciate your post. Thank you.

  • Andrew Taylor

    Thanks for posting this; I’m trying to work from your example to show a form, which then posts (so added app.post(‘/form’… into app.js). However, at that point, it needs to authenticate again.

    I’m a nube with node.js, so not clear how you acquire req.query.code in the app.get(‘/’…) section – does nforce auto-prompt the oauth and pass this back in the request?

    I can’t save this and re-use it in the /form post handler (i.e. using req.query doesn’t work in the authenticate method again). Could you point me in a direction where I can continue?

  • Virginia Leandro

    Thank you so much for this! It filled in a lot of blank spaces for me after looking at countless other examples. The only challenge I had was gulp.exe wouldn’t run on my Windows machine. I ended up doing a npm install and was able to get everything sorted! Great example…

    • Thanks! Sorry about the gulp.exe issues. I’ll see if I can get those fixed.

  • Tim Powell

    Hi James – I was just trying to follow through your instructions and ran into the following error. Any ideas?

    npm WARN EPACKAGEJSON quick-force@0.0.1 No repository field.

    npm WARN EPACKAGEJSON quick-force@0.0.1 No license field.

    [12:17:49] Using gulpfile ~/Downloads/tpcon/jamesward-quick-force-node-55ee027/gulpfile.js

    [12:17:49] Starting ‘atom’…

    [12:17:49] Retrieving latest release of Atom

    [12:17:49] Starting ‘server’…

    [12:17:50] Finished ‘server’ after 263 ms

    [12:17:50] [nodemon] 1.11.0

    [12:17:50] [nodemon] to restart at any time, enter `rs`

    [12:17:50] [nodemon] watching: .env *.*

    [12:17:50] [nodemon] starting `node app.js`

    [12:17:50] [nodemon] failed to start process, “node” exec not found

    events.js:146

    throw err;

    ^

    Error: Uncaught, unspecified “error” event. (127)

    at emit (events.js:144:17)

    at ChildProcess. (/Users/TP/Downloads/tpcon/jamesward-quick-force-node-55ee027/node_modules/nodemon/lib/monitor/run.js:118:11)

    at emitTwo (events.js:87:13)

    at ChildProcess.emit (events.js:172:7)

    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)

    logout

    Saving session…

    …copying shared history…

    …saving history…truncating history files…

    …completed.

    Deleting expired sessions…14 completed.

    • Thanks for giving this a try! Sorry for the issues. The node executable wasn’t on the path. I’ve fixed that: https://github.com/jamesward/quick-force-node/commit/8a8fbaacf8be5005fed3b39cfcacc2915b3178ad

      Easiest thing for you might be to make that same change to your gulp file (in the project dir). Let me know if that works.

      • Tim Powell

        Hey James – appreciate you taking the time. After a clean start gulp worked well – thanks. I do have 2 more problem is you have a moment. The local version doesn’t appear to find the .env file I created (i.e. it doesn’t connect to salesforce from local – just keeps returning to the same instruction page to create .env). The second is the login to Heroku via Atom menu – Login error: Please specify a version along with Heroku’s API MIME type. ‘Accept application/vnd.heruko+json; version=3’. I’m assuming I need to change settings or config somewhere in Atom but I just don’t know enough about it. Appreciate you help if you get some time.

        • Thanks for continuing to work through this! The Heroku atom plugin issue is due to Heroku making an API change recently. I’ll work on a fix for that. For the .env I need to do some testing. I’ll report back.

          • Tim Powell

            Hey James – I just thought I’d let you know I’ve moved on to other things so no need to spend the time on my behalf. Thanks Tim

          • Cool. Sorry for all the hassle. I finally was able to update the Heroku Atom Plugin to fix the issue there.

  • Michele Amendolagine

    Hi James,
    i launced gulp on my Windows machine and i got the following error. Do you have any idea?

    thank you very much for your support

    Traceback (most recent call last):
    File “”, line 188, in
    File “”, line 186, in run_gulp
    File “”, line 161, in cmdline
    File “C:projectsgulp-launcherpythonbuildgulpout00-PYZ.pyzsubprocess”, line 493, in call
    File “C:projectsgulp-launcherpythonbuildgulpout00-PYZ.pyzsubprocess”, line 679, in __init__
    File “C:projectsgulp-launcherpythonbuildgulpout00-PYZ.pyzsubprocess”, line 893, in _execute_child
    WindowsError: [Error 193] %1 is not a valid Win32 application

    • Hmm… What version of Windows? How are you launching it?

  • Anupam Shrivastava

    How can we call REST to fetch data instead of Query to fetch data in app.js? I don’t want to use query. Urgent help needed.

  • Anupam Shrivastava

    Please help me by giving a sample code to call REST class defined in Salesforce in this codE with HTTP? Urgent help required.

  • Anupam Shrivastava

    Hello Mr James, I am stuck in this code and require your urgent help. Here I am sharing my NodeJS code along with the Client ID and secret (Its for testing purpose only so I shared these details also). Here you have retrived the data through SOQL query but I want to fetch the data from Account object using REST Apex web service. But I am unable to do so. If I hardcode my Salesforce credentials then it is working otherwise Session ID error is occurring. Can you please reedit this code snippet and call the APEX rest in following code. I am stuck in this code and have to submit the code for my college assignment anyhow. I copied the REST class code from https://developer.salesforc… and created an apex class and paste the code there. Please help me. I tried many ways but it didn’t work. Hoping for a quick response. Thanks in advance.

    Please check my app.js file at Google Drive link https://drive.google.com/open?id=1bjaem47Edyb0hMBd5VnQmrEPljtjHlj4

    • Your code was working fine for me. So perhaps the user you are OAuthing with doesn’t have REST API access. Can you email me? j.ward@salesforce.com

      • Anupam Shrivastava

        I have sent you the mail. Thank you for arranging some time to provide me help.