This section describes the API method of the WIFI platform used to authenticate and obtain the API Token that must be sent in all requests made to the API.
GET - Return API_Token
Returns the token for the user and password indicated in the header using the Authorization parameter. This token must be included in all subsequent requests to be able to validate the user.
https://<server-domainname>/rest/login |
Parameters
TYPE | Parameter | Significance | Type | Required | Default |
---|---|---|---|---|---|
HEAD | Atuhorization | Username and password in basic auth format | string | YES | - |
The user and password must be sent encrypted in Base64. The steps to follow in order to build the content to be sent in the Authorization parameter are:
Build the string with the format user:password
Encode the string in Base64
Add to the request the "Authorization" header with the "Basic" content followed by the Base64 encoded string.
For example, for the user USER and password PASSWORD, we would get the string USER:PASSWORD. Then it is coded in base64 as VVNFUjpQQVNTV09SRA==, so the request to obtain the Access Token for this user would be as follows:
curl -D- -X GET -H "Authorization: Basic VVNFUjpQQVNTV09SRA==" -H "Content-Type: application/json" "https://<server-domainname>/rest/login" |
Response
HTTP CODE | Result | Response data |
---|---|---|
200 | Ok | [ "api_key", "203BB1A4690CAD" ] |
400 | Bad Request | Incorrect params, not o malformed header |
401 | Unauthorized | Password incorrect |
403 | Forbidden | User not exist |