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.- 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.
- WebAPI:
- Go to the Account section and find the token endpoint.
POST /api/Account/Token
- Enter your credentials on login and then click Try it out.
{ "username": "{your_username}", "password": "{your_password}" }
Note: You needvalid 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" }