Authenticate on IEM¶
Before you can stat using APIs of Industrial Edge Management you have to authenticate on IEM and get an access token. You will send this token with every request in http header to authorize yourself that you are allowed to use the APIs.
Get authentication token for IEM API¶
To retrieve a time limited user-specific access token, you need to send a POST request in the /portal/api/v1/login/direct
endpoint with a JSON body that includes your username and password or the credentials of a technical user.
Info
The access token is valid for 24h, this is expressed by the provided epoch time stamp within the response
curl -i -X POST -H "Content-Type:application/json" --insecure -d '{"username":"<your-username>", "password":"<your-password>"}' 'https://<your-iem-url>/portal/api/v1/login/direct'
If the authentication is successful, you will receive a response containing the access token, e.g.
{"data":{"access_token":"bea774c09da277d619ca12ceb09f924b","expires_in":1642721553987}}
This access token must be used within the Authorization
header for further requests.
IEM URL¶
Note that the <your-iem-url>
is either the DNS of your IEM or the IP address and port 9443
of the IEM. This depends based on how you set up your IEM.
If you used IP based setup then you must add a port 9443 after the IP address e.g
https://192.168.159.239:9443/portal/api/v1/login/direct
If you used DNS based setup then you can use just the DNS name e.g.
https://myindustrial-edge-management.com/api/v1/login/direct
SSL certificate problem¶
Note that that if your IEM is using untrusted certificates you must add --insecure
flag, cURL would fail due to SSL certificate problems with a message like:
curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: https://curl.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.