Add the Code to Call the Action

We’ll add the code that calls the Create_Delivery action by using the REST API.
  1. Navigate to the Shipify-Node-App directory where you downloaded the Shipify Web application. Copy the file shipment_with_action_api_call.js to file shipment.js.
    • On a Windows computer, the command would be: copy shipment_with_action_api_call.js shipment.js
    • On a Mac OS computer, the command would be: cp shipment_with_action_api_call.js shipment.js
  2. Confirm that you want to overwrite shipment.js.
  3. Enter this command to get the files ready to commit: git add —A
  4. Enter this command to commit the changes along with a comment: git commit —m 'MyChangeComments'
    If you’re working from a Windows computer, you may need to replace the single quotes with double quotes (").
  5. Enter this command to deploy the app to Heroku: git push heroku master

Example

If you look at the code in shipment.js that creates the delivery record, you’ll see that it passes the invoice ID and does a POST to the /quickActions/Create_Directory resource.

We’ve got our API call all ready to go, so let’s test it out by shipping a customer order.