Cognotix offers a REST API that allows you to retrieve a variety of data and metadata related to your account, surveys and survey responses. Additionally you may activate and deactivate surveys via the REST API.
The REST API is only available over HTTPS to ensure data security. API request attempts made over HTTP will fail.
All of the resources described in our API documentation have the following base URL:
https://www.cognotix.com/api/v1
All Cognotix REST API requests require you to authenticate using HTTP basic authentication. Your username is the username you use to normally login to Cognotix. Your password is the API AuthToken displayed in the "integration" section of your dashboard.
Cognotix REST resources are accessed via an HTTP GET or POST request to the the resource URL. The request method required is specified on the documentation page for each resource. All POST requests must supply a JSON request body, but specifying a content-type is not required.
The Cognotix REST API returns JSON responses. Please review each resource's documentation page for an example of its specific response.
An example of a Curl request to the REST API is below:
curl -u USERNAME:AUTHTOKEN https://www.cognotix.com/api/v1/getbalance
This would generate the following response:
{"GetBalanceResult":55.25}
The Cognotix REST API returns JSON responses. Please review each resource's documentation page for an example of its specific response.
In addition to the JSON response body, REST API responses include an HTTP status code. The table below shows the possible status codes:
| Status Code | Description |
|---|---|
| 200 | OK - Your request was successful. |
| 400 | Bad Request - Your request was invalid or could not be understood by the server. |
| 401 | Unauthorized - The supplied credentials are invalid or no credentials were specified. |
| 404 | Not Found - The requested resource could not be found or does not exist. |
| 405 | Method Not Allowed - The resource expects a POST request, but you tried a GET or vice-versa. |
| 500 | Internal Server Error - The server encountered an error while processing your request and failed. |
| 503 | Service Unavailable - The service is temporarily unavailable. Please try again later. |