Set up Postman for Model API
Set up
global variables
Go
to the eye in the upper right hand corner
under
Globals, click Edit
Add
a row for model-api-token
Add
API call
In
the left hand menu, Under the Model-API collection, add a new request.
Example is below. You can include request parameters, request body, etc.
to the request
In
the upper right hand corner, select LocalHost as the environment
Alternatively, you can set up a Postman script to
automatically make a login request and set model-api-token.
In a
browser, open the developer tools and navigate to the network tab.
In the
network tab, search the keyword "token". Find the Post request
to {url}/authorization/oauth/token. Copy the entire URL
In
Postman, create a new request. Select POST and paste the URL.
Go to
the Scripts tab and paste the following code:
const response = pm.response.json();
const accessToken = response.access_token;
pm.globals.set("model-api-token", accessToken);
console.log("Access Token:", accessToken);
Setting up OAuth2 Token for Postman
You can set all the values as variables if you want
Add 2 Auth Request URL Parameters, for the token make sure
to use the community ID you want
User_type must be customer