Get Security Token

The Get Security Token API returns a Mongoose security token for a specific user, which can be used to authenticate requests when calling the API directly.
Get Security Token
Note: This topic is for REST Version 1. There is also an API for REST Version 2.

Parameters

Name In Required? Description
responsetype Path Yes Response request data format: Supply any of these values:
  • xml
  • json
  • js
config Path Yes This is the name of a configuration available on the application server.

Headers

Name Description
userid Mongoose username
password Mongoose user password

Request data

None

Response data in XML format

If successful, the call returns a neatly packaged security token.

<MGRestTokenResponse xmlns="http://schemas.datacontract.org/2004/07/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <Message>Success</Message>
  <Token>b/XdI6IQzCviZOGJ0E+002DoKUFOPmVDkwpQDb...YOdU2ThSw==</Token>
</MGRestTokenResponse>

Response data in JSON format

If successful, the call returns a neatly packaged security token.

{
   "Message": "Success",
   "Token": "b/XdI6IQzCviZOGJ0E+002DoKUFOPmVDkwpQDb...YOdU2ThSw=="
}

Response data in JS format

If successful, the call returns the security token itself (no envelope).

b/XdI6IQzCviZOGJ0E+002DoKUFOPmVDkwpQDb...YOdU2ThSw== 

Example

This example code retrieves a Mongoose security token for the given user ID, password, and configuration name.

string token = string.Empty;
 
using ( HttpClient client = new HttpClient() )
{
   // provide your Mongoose credentails in the request url
   string config = "CSI_DALS";
   string requestUrl = $"http://server/IDORequestService/MGRESTService.svc/js/token/{config}";
 
   // provide your Mongoose credentials as headers
   client.DefaultRequestHeaders.Add( "userid", "sa" );
   client.DefaultRequestHeaders.Add( "password", "" );
 
   // send the get request
   HttpResponseMessage response = client.GetAsync( requestUrl ).Result;
 
   using ( HttpContent content = response.Content )
   {
      Task<string> result = content.ReadAsStringAsync();
      // this contains your token
      token = result.Result;
   }
}