DADI has rebranded to Edge. Find out more.

How To: Automate DADI API Authentication in Paw

Paw, much like Postman, is an app for interacting with REST APIs.

Paw, much like Postman, is an app for interacting with REST APIs. Unlike Postman, however, it’s a native Mac OS app and does have a one-off cost of £39.99 (~$55 USD) — but the designer in me prefers Paw’s more polished interface so I’m happy to spend the money (you may be too, now, as Paw is offering a 20% discount to DADI users).

So, just as Eduardo’s productivity hack helped automate authentication in Postman, this tip will save you the pain of having to refresh your Bearer token frequently when working with DADI API. Except with Paw, it’s even easier.

🔗Setting up the token fetch

The first thing you want to do after setting up your DADI API is to create a request to the /token endpoint. With my development API running locally on http://127.0.0.1:8081, the token endpoint is available at http://127.0.0.1:8081/token.

The key steps are:

  1. Make sure your DADI API is running

  2. Set the method to POST

  3. Make sure the endpoint is /token (unless you specifically changed it in API)

  4. In Body > JSON set your clientID and secret key/values.

  5. Send the request using ⌘ + Enter or the refresh icon.

If successful you will receive a JSON response containing an access token, similar to the below image:

*The DADI API token fetch correctly configured*

🔗Copy the returned access token

In the response pane on the right side you should see accessToken returned along with some other properties.

Right-click the accessToken cell and select Copy as Response Body Dynamic Value.

*Copy the accessToken*

🔗Fetching one of your collections

The final step is to make any other request to the API. Here, I’m fetching some articles:

  1. Click the + bottom left to create a new request

  2. Type in your desired endpoint e.g., http://127.0.0.1:8081/1.0/cloud/articles

  3. In Headers create a new header named Authorization. The value field should contain Bearer then paste the copied value from the previous step.

The value should read Bearer [Response Parsed Body: Your request name ► accessToken]. And in the raw request view below you should see the value resolved to the actual token.

*The API should now authenticate and return results*

That’s it, the authentication step will now take place automatically whenever you perform a new request. You can repeat the steps to continue creating API requests.

Related articles

More tutorials articles
Mail icon

Like what you are reading? Want to earn tokens by becoming an Edge Node? Save money on your hosting services? Build amazing digital products on top of Edge services? Join our mailing list.

To hear about our news, events, products and services, subscribe now. You can also indicate which services you are interested in, which we use for research and to inform the content that we send.

* You can unsubscribe at any time by emailing us at data@edge.network or by clicking on the unsubscribe link which can be found in our emails to you. Read our Privacy Policy.
Winner Best Edge Computing Platform Technology & Innovation Awards
Presented by Juniper Research