EndPreviousNextEnd EndPrint This TopicEnd

Webservices / APIs

The GetAuthToken webservice is used to generate an authentication token which you can use to authenticate all of the other Contegro webservice calls.

 

Authentication tokens have an expiry date (the length of time before a token will expire can change from site to site).

 

Normally, authentication tokens will only work from the IP address which the GetAuthToken request was made from (Contegro supports having multiple tokens associated with the same IP address).

 

The exception to this is authentication tokens which are generated from a call to the LogInUser webservice. These authentication tokens have a much longer expiry date and are not restricted to an IP address

 

If you are developing on a system which may change its IP address regularly (i.e.: a tablet or phone), you should keep track of when the IP address changes and request a new authentication token when that happens.

 

Data to be passed to the webservice

Variable name

Data type

Description

username

String

The username which you have been given to communicate with the webservice

password

String

The password which you have been given to communicate with the webservice

apiVersion

String

Not currently used, but please pass 1 as the apiVersion so that future updates don't break your code

 

Data which is returned

Variable name

Data type

Description

token

String

The auth token which you can use when calling the other APIs. If your GetAuthToken request had a problem, this will be an empty string

expiryDate

DateTime

The date and time that the auth token will stop working

errorCode

String

If your request was successful, the errorCode will be 0

If your request had a problem, there will be an error code for each kind of problem

errorMessage

String

A description of the problem with your error request (if there was a problem)

If your request was successful, this will be an empty string

 

Example XML for a GetAuthToken request

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

 <soap:Body>

         <GetAuthToken xmlns="http://contegro.com/">

                 <username>my_username</username>

                 <password>my_password</password>

                 <apiVersion>1</apiVersion>

         </GetAuthToken>

 </soap:Body>

</soap:Envelope>

 

Example XML which is returned

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

 <soap:Body>

         <GetAuthTokenResponse xmlns="http://contegro.com/">

                 <GetAuthTokenResult>

                         <token>ea1f64f2-8bf3-458f-b97b-57839d7402da</token>

                         <expiryDate>2016-01-29T12:23:04.8452553+13:00</expiryDate>

                         <errorCode>0</errorCode>

                         <errorMessage/>

                 </GetAuthTokenResult>

         </GetAuthTokenResponse>

 </soap:Body>

</soap:Envelope>

Topic Link