Setting Up Postman
Start up Postman and let’s get started!
Create Collection
- On the Collections tab, click the New button and then select Collection.
- In the New Collection screen, set the name as
Domino-REST-API-NewDB
. - Switch to the Variables tab and add the variables:
- HOST - This should map to the Domino REST API URL and should end
/api/v1
. For example, if you’re running Domino REST API locally and with the default ports, this will behttp://localhost:8880/api/v1
. - SETUP_HOST - This should map to the Domino REST API URL and should end
/api/setup-v1
. For example, if you’re running Domino REST API locally and with the default ports, this will behttp://localhost:8880/api/setup-v1
.
- HOST - This should map to the Domino REST API URL and should end
- Click the Save button.
Create Authentication
-
Hover over the
Domino-REST-API-NewDB
collection name and click on the ellipsis (three dots). Select Add Request. - Name the request
authenticate
. - Change the method from GET to POST.
- Set the URL as
{{HOST}}/auth
. - On the Headers tab add a header for Content-Type, set to
application/json
. - On the Body tab change the type to
Raw
and also change the type fromText
toJSON
. -
Enter the following JSON in the body replacing the values for your username and password with your actual username and password.
{ "username": "replaceWithUsername", "password": "replaceWithPassword" }
-
Click Send to make the request.
If you get a 404 message, verify the method is POST and the Content-Type header is set correctly. Validation requires these.
Store Bearer Token
-
On the Tests tab add the following code:
var jsonData = pm.response.json(); pm.collectionVariables.set("bearer", "Bearer " + jsonData.bearer);
- Line 1 extracts the HTTP response as JSON.
- Line 2 extract the bearer token from the response and stores it in a collection variable for use in all future authenticated requests.
- Click Send to make the request again.
- Hover over the
Domino-REST-API-NewDB
collection name and click on the ellipsis (three dots). Select Edit and check the Variables tab. You should now see the bearer token also stored. - Save and close the request.