API interaction format

WaspAce API works in JSON format at http://api.waspace.net

Interaction codes

Format of POST requests processing

Request

Request body should contain the following string with JSON-object:

v={
 "Action":<ACTION_CODE>,
 "Data":{
  <ACTION_DATA>
 }
}

Where

  • <ACTION_CODE> - request code.
  • <ACTION_DATA> - data dependent on the operation code.
  • «v=» - used to work with JavaScript.
Response

In the body of the server response the string will be contained:

<head><script>window.name="<RESPONSE_JSON_OBJECT>"</script></head>

Format of GET requests processing

Request

The request string should look like this:

http://api.waspace.net/<ACTION_CODE>/{<ACTION_DATA>}

Where

  • <ACTION_CODE> - request code.
  • <ACTION_DATA> - data dependent on the operation code.
Response

In the body of the server response the string will be contained:

<RESPONSE_JSON_OBJECT>

Where

  • <RESPONSE_JSON_OBJECT> - Server response in JSON format.

Types of server responses

Request is successfully done
{
 "Status": <SR_SUCCESS>,
 "Data": {
  <RESPONSE_DATA>
 }
}

Где

  • <SR_SUCCESS> - Status of the request, indicating successful execution
  • <RESPONSE_DATA> - Data in JSON format, the content of which depends on the request. If the data in the response is not required, the Data object in the response will be absent.
Request failed, general error was occured.
{
 "Status":<SR_GENERAL_ERROR>,
 "Error":<GENERAL_ERROR_CODE>
}

Where

  • <SR_GENERAL_ERROR> - response status, meaning the general error.
  • <GENERAL_ERROR_CODE> - one of the common error codes.
Request failed, an error occurred on request
{
 "Status":<SR_QUERY_ERROR>,
 "Error":<QUERY_ERROR_CODE>
}

Where

  • <SR_QUERY_ERROR> - response status, meaning a mistake on request
  • <QUERY_ERROR_CODE> -one of the error codes on request.

Additional information

  • Encoding requests and responses - UTF-8.
  • Response from the server comes in a format JavaScript encodeURI.
  • Request to the server can also be encoded by function similar to JavaScript encodeURI.