Api options

This version of the API docs is depreciated and will be taken offline soon.
Please migrate to the new version as soon as possible to avoid service disruption.

New version can be found at https://docs.wceaapi.org/

The WCEA API comes with a few built in options that can be altered to suit your application's needs.

Most of the time, this is handled transparently by the SDK, however, this page shows some low-level features that can be accessed or modified.

Envelope

All responses from WCEA API come with an envelope, which contains meta information, such as Status and Count. This envelope can be turned off by sending ?envelope=false in the request URI.

Error suppression

When an error is encountered by the API, the usual behaviour is to return a HTTP error code in the response, and a payload containing more details about the error (See Errors).

However this behaviour can be turned off by sending ?suppress_response_codes=1 in the request URI.

If error codes are suppressed, all errors will return a 200 OK response header. However the response body will contain the error details.

Response type

By default, the API serves content in JSON. However it also supports XML and CSV responses.

XML responses can be turned on either by adding a ?type=xml in the query. Or by sending an Accept header with the value of application/xml.

CSV responses can be turned on either by adding a ?type=csv in the query. Or by sending an Accept header with the value of application/csv.

Please Note: Nested data cannot be converted into CSV, so endpoints that return nested data, will throw an error, when you try to access the data in CSV format.

Request data type

By default, the API expects POST and PUT data to be in multipart/form-data or multipart/x-www-form-urlencoded formats.

However, it can also accept JSON data if you send a Content-Type header with the value of application/json.

All the options on the left are for cURL based requests only.

For the PHP SDK, these options are handled internally by the SDK.

Internally, the PHP SDK:

  1. Has envelopes turned on
  2. Does not suppress errors
  3. Receives only JSON responses
  4. Automatically POSTs and PUTs JSON formatted data


The PHP SDK can be made to accept XML and CSV responses too. However these responses are presented back in their raw format.

Only JSON responses are converted to a PHP array once they are received.

To turn on XML or CSV responses, you can set the configuration item while instantiating the SDK:

$API = new Verified(array(
   "api_key"        => "blahblahblah",
   "api_secret"     => "blahblahblah",
   "response_type"  => 'csv' // <-- specifying response type
  )
);
Or, you can specify the configuration item after the SDK has been instantiated:
$API = new Verified($config);
$API->setConfig('response_type', 'csv');