Making a REST API call using OAuth - EcoSys - Customization & Programming - Hexagon

EcoSys Web Service API Usage Documentation

Language
English
Product
EcoSys
Search by Category
Customization & Programming
EcoSys Version
9.3

After EcoSys is configured, you can use any API tool to access EcoSys REST APIs. The following steps describe how to make a request to get a Token and then use the Token to make a request for data from EcoSys.

The following calls can be made in any API tool such as Postman, Swagger, and so on.

Getting a Token from the OAuth Provider

  1. Create a request using the HTTP method POST.

  2. Set the URL to the token provider’s Token URL.

  3. The content type of the body should be x-www-form-urlencoded.

  4. The body should have the following attributes

    • grant_type - Set to ‘client_credentials’

    • client_id - Enter the Client ID as it is set in the OAuth provider

    • client_secret - Enter the Client Secret as it is set in the OAuth provider

    • Scope - Enter the Scope as it is set in the OAuth provider.

  5. Execute the request to retrieve a token.

    The access token will be displayed in the response body. For example, "accesss_token": " __access_token_string__ "

    The "__access_token_string__" is a long token which will be used in the API request to EcoSys.

Calling EcoSys Smart API

  1. Create a request using the HTTP method GET.

  2. Set the URL to the EcoSys REST API endpoint https://<server name>/ecosys/api/….

  3. The body should have the following attributes:

    • Authorization – Set to Bearer <__access_token_string__ >

      For example: Bearer eyJraWQi…

  4. Execute the request to retrieve data from EcoSys.