To test a workflow in Modern Logic from beginning to end, you can always use the Test and Backtest buttons in the Rules Editor interface. However many people like to use Postman as well, to see exactly what will be returned from API calls to Modern Logic.

Let's walk through how to use Postman to hit the basic Onboarding Workflow on the Modern Logic Sandbox.

<aside> ⚠️ If you've recently created a workflow, don't forget to deploy your latest changes before testing the API!

</aside>

1) Set up Authentication:

First, let's create a new API Token for authentication. Click on the Account block at the bottom right of the Sidebar, and then click Settings. From the Settings page, Click on the Tokens tab.

Click Generate Token and then the copy icon next to your new token string.

Screen Shot 2021-10-25 at 7.04.12 PM.png

Now in Postman, let's create a new collection, and set up authentication for Bearer Tokens.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d7d9dbc0-58cc-40b6-9f1e-928f0e60128c/animation.gif

Don't forget to click Save on your new collection. If you miss clicking save, then your newly added token will be left out of your API Requests.

2) Create API request:

Back in Modern Logic, navigate to the Workflows page, and open your Workflow. Click on the API Call node, which is always the first node on the graph.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/4b17d955-be73-482c-be7f-0dc576aa3891/Screen_Shot_2021-06-11_at_9.55.12_AM.png

Just below the title, you'll see a url for this workflow.

This URL stays the same as you update new versions of this workflow; you can always access the latest version of the workflow by making API requests to this URL.

Let's copy this url (ending in /execute)

<aside> 🚨 Note for Sandbox users, workflow URLs currently aren't formatting properly. Please try: https://api-sandbox.usemodernlogic.com/v1/workflow/<#>/execute where <#> is the workflow_id from the URL displayed. We hope to have this fixed week of June 14

</aside>

Next return to Postman. In your new Collection with Authentication already configured create a new post request. Paste the URL for your workflow, make sure Authorization is inheriting the bearer token properly, and Body is set to Raw > JSON

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c29d30f4-eb54-423a-9333-9eea6721d4c1/animation.gif

Finally, let's put some sample data in the body of the request. Just copy the JSON below into the the body of the request in Postman and click Send. You can add any additional fields you'd like to use in the extraProperties field.

<aside> ⚠️ Note: our API is currently a little picky about using camelCase. It will complain about using last_name instead of lastName for example. A fix should be available by July, 2021

</aside>

{
    "age": 47,
    "dob": "1992-05-09",
    "ssn": "509-50-2965",
    "city": "South Lake Tahoe",
    "name": "Crawford Roscrigg",
    "email": "[email protected]",
    "phone": "301-555-5555",
    "state": "CA",
    "address1": "9905 Killdeer Street",
    "lastName": "Shank",
    "firstName": "Nicholas",
    "income_source": "wages",
    "customerId": "12345G",
    "time_to_complete_form": 17
}