1.4. Authentication

The first step in using the Celoxis API is to authenticate to the server. This user must have administrative privileges. We recommend that you create a special user dedicated to using the API. On successfully authentication, you will receive a token that should be passed in every API call else the call will be rejected with an authentication error. You can authenticate any user not just administrators and operations can be performed on behalf of any user; it is only the token that must be the result of authentication of an administrative user.

You can authenticate like this:

api.do?function=login&username=[username]&password=[password]&company-code=[company code]

If data format is XML and your autehntication is successful, you will receive XML with two elements: token and user_id. For example:

<result><token>ae48ef19bcfd1</token><user_id>12918</user_id></result>

In case the data format is JSON, you will receive an object with properties token and user_id respectively. On how to handle errors, see Error Handling and Debugging (Section 1.6)