SessionOpen API
/sessionOpen is an optional API that can be used to get the new token with a new expiration date by providing username, password (RotueLink® User Interface (UI) credentials ) and the API client name for which the new token is being requested. This API can only be used to get a new token when token has expired for a given API client.
/sessionOpen Request
The following is an example REST/JSON/sessionOpen request:
{
"username":"<username>",
"password":"<password>",
"apiClientName":"<apiClientName>"
}
The RouteLink Client communicates a session open request for a Sandbox API client using the following URL:
/routelink/v2/sessionOpen/sandbox
An example of sending a session open request for a Sandbox API client using wget is as follows:
wget --header="Content-Type: application/json" --post-data='{"username":"user1","password":"pass1","apiClientName": "sandboxApiTest"}' https://api-routelink.somos.com/routelink/v2/sessionOpen/sandbox
The RouteLink Client communicates a session open request for a Production (aka live) API client using the following URL:
/routelink/v2/sessionOpen/live
An example of sending a session open request for a Production (aka live) API client using wget is as follows:
wget --header="Content-Type: application/json" --post-data='{"username":"user1","password":"pass1","apiClientName": "liveApiTest"}’ https://api-routelink.somos.com/routelink/v2/sessionOpen/live
/sessionOpen Response
The following is an example JSON session open response from RouteLink.
{
"token":"c0d97b52-35d9-32c2-a37d-6126a186a844",
"expiration":"01/09/2017 15:56:21" // always in GMT
}
Field Descriptions | ||
Field | Range | Comments |
token | Printable String | The new token. The former token is no longer valid. |
expiration |
MM/DD/YYYY HH:mm:ss | The expiration timestamp of the new token. This value is always in GMT. The HH:mm:ss portion is in 24-hour format. |
This API will result in the following error message if the token has not expired for the given API client:
{
"error":"temporary",
"messsage":"Token has not expired for the api client 'test4'. Please use the /refreshToken api to get a new token."
}