Postman is a widely used application to access data from REST APIs.

This is a tutorial on how to configure Postman to access data from the More Service API using OAuth 2.0 with Password Grant.  

Documentation on the available endpoints in More Service can be found here: https://api.tmsportal.no/gapi/swagger/ui/index#!/

In short, first you fetch an access token in step 1, then you can request data from the API using your given token in Step 2.

Step 1 - Fetch a Token from More Service API

  1. Open Postman and enter the following URL: https://oauth2.tmsportal.no/token

2. Add the following parameters under the tab "params".

grant_type


username


password


client_id


client_secret




3. Enter the values given by to you by More Service for username, password, client_id, and client_secret.


4. Select the tab "Headers" and add:

Content-Typeapplication/x-www-form-urlencoded


5. Change the request type to "POST"



6. Click "Send"


7. If all the parameters entered are valid, the server will respond with a JSON object containing an Access Token.


Step 2 - Fetch data from the REST API using the Access Token

8. Add the following URL to Postman: https://api.tmsportal.no/gapi/v1/[controller-action] (See a list of available actions here:  https://api.tmsportal.no/gapi/swagger/ui/index#!/)


9. Go to the tab "Headers" and add:

Content-Typeapplication/x-www-form-urlencoded


10: Go to the tab "Authorization" and select "Bearer Token as Type. In the "Token" -field, enter the token you were given in Step 1.


11: Click "Send"


12. If the Token is valid, the request URL exists and the configured permissions are valid, the server will reply with a JSON object.



  • No labels