Response Format
Records stored in your app are indexed by the field key (e.g. field_1) and include a unique record ID which you can use to specify that record in subsequent requests. See below for a examples responses you might see for a GET request for multiple records as well as for any GET, POST, or PUT request which returns a single record.
Single Record
When retrieving a single record via a GET request, inserting a record via a POST request, or updating a record via a PUT request, the JSON body of a successful response will be the record in question as a JSON object.
Example Response (200 OK)
{
"id": "58643557d1ea9432222f3cbb",
"field_1": "Pearl Architectural Design",
"field_1_raw": "Pearl Architectural Design",
"field_17": "<a href=\"http://www.pearlinc.com\" target=\"_blank\">http://www.pearlinc.com</a>",
"field_17_raw": {
"url": "http://www.pearlinc.com"
},
"field_18": "Services",
"field_18_raw": "Services",
"field_31": "516-334-3077",
"field_31_raw": "516-334-3077"
}
Multiple Records
When retrieving multiple records via a GET request, the body of your response will be a JSON object containing the following information:
{
"total_pages": 1,
"current_page": 1,
"total_records": 2,
"records": [
{
"id": "58643557d1ea9432222f3cbb",
"field_1": "Pearl Architectural Design",
"field_1_raw": "Pearl Architectural Design",
"field_17": "<a href=\"http://www.pearlinc.com\" target=\"_blank\">http://www.pearlinc.com</a>",
"field_17_raw": {
"url": "http://www.pearlinc.com"
},
"field_18": "Services",
"field_18_raw": "Services",
"field_31": "516-334-3077",
"field_31_raw": "516-334-3077"
},
{
"id": "58643556d1ea9432222f3ca6",
"field_1": "Kelly and Cohen",
"field_1_raw": "Kelly and Cohen",
"field_17": "<a href=\"http://www.kellycohen.com\" target=\"_blank\">http://www.kellycohen.com</a>",
"field_17_raw": {
"url": "http://www.kellycohen.com"
},
"field_18": "Services",
"field_18_raw": "Services",
"field_31": "315-296-4146",
"field_31_raw": "315-296-4146"
}
]
}
Multiple Records: Response Data
The Knack API uses status codes in the 200
range to indicate success and status codes in the 400
range to indicate an error. Codes in the 500
range indicate a server-side error. Most errors can be fixed by checking the JSON formatting of your request’s body (there are plenty of great online JSON validators), your application ID, and (for object-based calls) your API key.
Code | Request Type | Message | Notes |
---|---|---|---|
200 OK | POST/PUT | <Created/updated record (JSON), including ID> | |
200 OK | GET | <Record(s) queried> | |
200 OK | DELETE | { “delete”: true } | |
400 Bad Request | Any | Malformed App ID | |
401 Unauthorized | Any | Invalid API key | |
401 Unauthorized | Any | Invalid API request | Results from no application ID included among request headers. |
403 Forbidden | Any | Invalid or Expired Token | Results from trying to authenticate a view-based request with an expired user token. |
429 Too Many Requests | Any | Either "Rate limit exceeded" or "Plan Limit Exceeded" | Read more here |
Updated about 4 years ago