Invoking APIs‎ > ‎

Response Formats

Demo Response Formats in the REST Lab

  1. Go to Execute, REST Lab, Request and select the Args checkbox.
    A section of parameters is revealed. 
    The following image shows the Args checkbox selected and the expanded section of parameters:
  2. Choose a response format from the Response Format drop-down.
    Options:
    • csv. Comma separated values, each record is separated by a line end. Resources are flattened out to the topmost level.
    • json. (Default) JSON is a ubiquitous format on the web and the default output of API Server.
    • jsonObject. The object format for JSON changes the hierarchy of the data returned, putting the returned records in a nested "data" attribute.
    • xml. Restructures metadata into XML tag attributes.
Default: json

For more information:

  • About demoing the response formats using the REST Lab, see Test Using the REST Lab.
  • About viewing the filtering and ordering section of the page using the Args checkbox, see GET.

Globally Describe the Expected Response Format

You can set the expected response format globally across an API using the Default response format field.

For more information about this API property setting, see API Properties.

Override the API Default Response Format Settings

You can override the API default settings on a per-request basis by passing in a HTTP Header: "X-CALiveAPICreator-ResponseFormat" or by defining the responseformat URL variable. When conditionally requesting CSV, for example, a user might define it as such:

 HTTP Header     X-CALiveAPICreator-ResponseFormat: csv
 URL Variable    https://lapicbaseurl.com/rest/default/api-url-fragment/v1/main:table?responseformat=csv

You can have the header and URL variable defined, the priority from least to greatest, such as API default setting, HTTP header, URL variable.

For more information about the HTTP headers you can specify, see HTTP Headers.

Remove Metadata Attributes

The XML and CSV formats support the nometa URL variable. This URL variable optionally removes the metadata attributes (and for XML, the raw-name attribute for column values).