GetSecurityToken
The GetSecurityToken API returns a Mongoose security token for a specific user, which can be used to authenticate requests when calling the API directly. You can also pass credentials in request headers, which is recommended for usernames and passwords with special characters.
Note: This topic is for REST version 2. See GetSecurityToken for the REST version 1.
Endpoint
- Path-based
GET /token/{config}/{username}/{password}http://localhost/IDORequestService/ido/token/CSI_DALS/sa/Passwe1rd - Header-based
GET /token/{config}\http://localhost/IDORequestService/ido/token/CSI_DALS
Parameters
| Name | In | Required? | Description |
|---|---|---|---|
| config | Path | Yes | The name of a configuration available on the application server |
| username | Path/Header | Yes | The username for the Mongoose user |
| password | Path/Header | Required for Header-based request | The password for the Mongoose user |
Headers
None
Request data
None
Response data
{
"Message": null,
"Success": true,
"Token": "b/XdI6IQzCviZOGJ0E+002DoKUFOPmVDkwpQDbQj…=="
}
Example
This example code retrieves a Mongoose security token that can be used in succeeding requests.
string json = string.Empty;
using ( var client = new HttpClient() )
{
string config = "MG_DEV";
string username = "sa";
string password = string.Empty;
string requestUrl = $"http://server/IDORequestService/ido/token/{config}/{username}/{password}";
// send the get request
HttpResponseMessage response = client.GetAsync( requestUrl ).Result;
using ( HttpContent content = response.Content )
{
Task<string> result = content.ReadAsStringAsync();
// get the response containing the token
json = result.Result;
}
}