Create access tokens

  • Having an existing and active user account to access the GPM Plus or GPM SCADA environment.

  • Having the client {host} and {port}, where {host} is your company host name and {port} is the port you use to connect to the system. The host and port can be found in the URL: www.http://{host}.greenpowermonitor.com:{port}.

To create an access token, or bearer token, follow these steps:

Note: You need the client {host} and {port}, which can be found in the URL: www.http://{host}.greenpowermonitor.com:{port}.
Note: The token expires 24 hours after either its creation or its last use. If the

GPM Web API

calls returns a 401 error, indicating an expired token, you will have to create a new token. However, if the token is used within the 24-hour timeframe, it will be automatically refreshed, and this cycle continues every subsequent 24 hours with each usage.
  1. Access the Client Swagger using one of the following links:
    • WebAPI: https://webapi{host}.horizon.greenpowermonitor.com/swagger/ui/index/#
    • SCADA: http://{host}.greenpowermonitor.com:{port}/swagger/ui/index#/
      Note: {host} is your company host name and {port} is the port you use to connect to the system.
  2. Go to the Account section and find the token endpoint.
    POST /api/Account/Token
    Layer 1
  3. Enter your credentials on login and then click Try it out.
    {
      "username": "{your_username}",
      "password": "{your_password}"
    }
    Layer 1
    Note: You need

    valid and active credentials for GPM Plus or GPM SCADA.

    If the request is successful, you will get a "200 HTTP" Status Code and a response body containing the access token and its expiration time.
    {
      "UserName": "{your_username}",
      "AccessToken": "{bearer_token}",
      "TokenType": "bearer",
      "ExpiresIn": "Minutes : xxxx.xxxxxxxxxxxx"
    }
    Layer 1
You have the access token. You must include it in all your GPM Web API calls.