Skip to main content

Initiating a Session

To be able to submit operative requests, the API client needs to first initiate a session to the SDK web service by creating an instance of the SDK generated proxy client (class: CxSDKWebService) with the SDK Web Service URL and calling the Login method as below. The method returns the CxWSResponseLoginData object, which includes the SessionId field that needs to be submitted in all subsequent methods.

CxSDKWebService.Login Method

public CxWSResponseLoginData Login(
   Credentials applicationCredentials,
   int lcid
);

Parameters

  • applicationCredentials: A Credentials object, with fields:

    • User: The username for login

    • Pass: The password for login

  • lcid: ID# of the language for web service responses. The current API version supports the following values:

    • 1033: English

    • 1028: Chinese Taiwan

    • 1041: Japanese

    • 2052: Chinese

Return Value

User data, including the .SessionId field

Example

To initiate a session using the CxSAST default credentials (admin@cx, admin), to be receiving English responses:

public void LogAdminIn()
{
  CxSDKWebServiceSoapClient cxSDKProxy = new CxSDKWebServiceSoapClient();
  CxWSResponseLoginData loginResult = cxSDKProxy.Login(new Credentials() { User = "admin@cx", Pass = "admin" }, 1033);
  sessionID = loginResult.SessionId;
}

SOAP to REST Mapping

This section covers SOAP to REST migration and mapping of our legacy SOAP based SDK to the new REST APIs. It is recommended to use this reference only once CxSAST V8.8.0 is installed.

Login

POST /auth/login

SOAP cookie-based login replaced with a REST Token:

Token-based Authentication / Login using OAuth 2.0.

Logout

LoginWithToken

SsoLogin

See above

See above

For more mapping information, refer to Mapping SOAP to REST.