Develop > Developer reference > Connect to the REST API

How to connect to the REST API

To connect and use the REST API, you must do all of the following:

  1. Establish a user (logon) session.

    Using SSO, each session must start with a call to the authentication endpoint:

    1. Send a POST request to /auth/authentication-endpoint/authenticate/login if you are using an integration user.

      Send a POST request to /auth/authentication-endpoint/authenticate/login?TENANTID=XXX if you are using an account user.

      Note Only integration users and account users with DB authentication type can use this API.

    2. The body of the request should be:

      { "Login":"%user login name%", "Password": "%user login password%" }

    3. From the response, note the value of the authentication token.

    4. Ensure each subsequent request includes a cookie header:

      LWSSO_COOKIE_KEY=%token%

      In the header, replace %token%with the value of the authentication token.

    For more information, see Authentication endpoint service.

  2. Include in each request, the tenant ID.

    In addition to the basic URL and record parameters, you must append the tenant ID.

    For example:

    • Basic URL format: https://../incidents?filter=...

    • With tenant ID appended: https://../incidents?filter=...&TENANTID=123

  3. Exclude from each request, the XSRF token.

    The best practice is to delete or ignore the XSRF token. If you do not do this, you must do either of the following:

    1. Provide a User-Agent HTTP header with the value Apache-HttpClient/<version>. The value must contain a version number, for example Apache-HttpClient/4.1.

    2. Send a token as an HTTP header named X-XSRF-TOKEN with the value taken from the latest XSRF-TOKEN cookie. (This is normal browser behavior.)

Related topics