How to consume REST API (swagger)

We tried our best to test REST API on postman, but it is showing 401 unauthorized error. Please guide me to resolve this, also guide me the right steps:

Where did you get the bearer token from?
I recommend, especially when using apps like postman, to setup an oAuth2 flow.
Similar to what you tried here:

1 Like

Thank you Martin,

I just follow the steps and able to get “Access Token”

  1. Open Postman and create a new request.
  2. Set the request method zo ‘POST’.
  3. Set the request URL to: https://{your-openremote-url}/auth/realms/{realm}/protocol/openid-connect/token
  4. In the request body, select the x-www-form-urlencoded option and enter the following parameters:
    grant_type: client_credentials
    client_id: {name-of-service-user}
    client_secret: {generated-secret-of-service-user}
  5. Click ‘Send’ to get response with access token

For getting information about a specific asset I did the following:

  1. Create new request in Postman.
  2. Set the request method to ‘GET’.
  3. Set the request URL to: https://{your-openremote-url}/api/master/asset/{assetID} (see also OpenRemote Manager HTTP API Swagger UI )
  4. Add an Authorization header to the request and set the value to Bearer {access_token}, where {access_token} is the access token obtained in the previous step.
  5. Click ‘Send’ button to send the request to OpenRemote.
    But here I am getting error as below attached: is the way I wrote ‘Bearer’ and after that access token is right?

Thank you Martin, now it is working good…