Using the API
Each call to the service must pass the API token key in request header field as "X-ApiKey". The service uses your private key stored in the web.config file to validate the incoming key. The Private Key should never be used in API calls and the call will fail if you attempt to do so.
JQuery Example:
request.setRequestHeader("X-ApiKey", authorizationToken);
If the key is not presented with the request, the transaction is quietly denied.
Calling the Service
The service is called by performing a Get operation and passing an action description as well as data needed for the transaction.
The service URL is:
http://<your_server>/lobbyCentralAPI/LobbyCentralApi.ashx
This is an example JQuery call that retrieves customers currently waiting or are in-service:
$.ajax({
type:"GET",
beforeSend: function (request)
{
request.setRequestHeader("X-ApiKey", authorizationToken);
},
url: "http://apiserver/lobbycentralAPI/LobbyCentralApi.ashx",
data: {'action':'getList',
'ver':'2',
'locID':'1',
'queueID': '-1'},
processData: false,
success: function(msg) {
//Do something with results
}
});
This is identical to: http://apiserver/ lobbycentralAPI /LobbyCentralApi.ashx?action=getList&ver=2&locID=1&queueID=-1
The data returned is stored in 'msg' which is an arbitrary name. Notice that in addition to the action, it also passes the Location ID 1 and Queue ID -1, which means return all queues.
Note: Action and Ver are required in every call, regardless of the action type. Ver should always be set to '2'.
Returning Data
Data is returned in JSON format. The payload is an array containing the two objects below.
Response Object
The response object provides an ErrorValue and Error message.
An ErrorValue=0 means the transaction completed successfully.
If an error occurred, the value is 1 and the error message is populated in Error.
Data Object
The data object contains the data being returned. It may be an array of objects or a single response.