Answers
Esta página aún no se encuentra traducida al español.
Overview
An answer is the representation of a submitted survey. It contains the latest version of the survey data.
These are just some of the most basic API requests. For a complete list of endpoints, consult our API documentation on Swagger.
Get Answers
Returns answers within the specified criteria. To get _answers you must provide either an answer uuid, a survey id, or property id in the query parameters. You can also use the query parameters to filter and find answers according to users or modified date. _
GET /answersEndpoint URL
https://www.cotalker.com/api/v2/answers
Headers
Header | Description | Required | Values |
---|---|---|---|
Admin | Authorizes access to answers. | Required | true |
Authorization | Sends your access token to make an API request. Click here to see how to obtain an access token. | Required | Bearer $ACCESS_TOKEN |
Query Parameters
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
extra | Adds extra information in the response regarding associated objects. | string[ ] | Optional | Options are: "channels", "properties", "users", "surveys", "questions", and "surveychats". More than one extra query parameter can be user per request. |
user | Returns answers submitted by the indicated user in regards to the specified criteria in one of the following query parameters: surveys, answer uuids, or properties. | ObjectId<COTUser>[ ] | Optional | |
survey | Returns answers from the specified survey. | ObjectId<COTSurvey> | Required if neither surveyIds , properties , nor answerUuids query parameters are being used. | |
surveyIds | Returns answers from the specified surveys. | ObjectId<COTSurvey>[ ] | Required if neither survey , properties , nor answerUuids query parameters are being used. | |
properties | Returns answers with the specified properties. | ObjectId<Property>[ ] | Required if neither survey , surveyIds , nor answerUuids query parameters are being used. | |
answerUuids | Returns answers with the specified answer uuids. | ObjectId<COTAnswer>[ ] | Required if neither survey , surveyIds , nor properties query parameters are being used. | |
modifiedAtGte | Returns answers with a value in the modifiedAt field equal to or greater than the indicated date and time. | ISODate | Optional | YYYY-MM-DDTHH:mm:ss.SSSZ |
modifiedAtLte | Returns answers with a value in the modifiedAt field equal to or less than the indicated date and time. | ISODate | Optional | YYYY-MM-DDTHH:mm:ss.SSSZ |
fullMatchProperties | Returns answers that contain all the properties searched for through the query parameters. | boolean | Optional | Must be used in conjunction with the properties query parameter. |
limit | Limits the amount of answers returned in the response. | number | Optional | By default, the limit is set to 10. |
page | Makes the response display data from the indicated page number. | number | Optional | Best used in combination with the limit parameter. |
count | Adds the counter field with the total amount of questions within the company. | boolean | Optional | |
orderBy | Returns answers in ascending or descending order. | string | Optional | Must be used in conjunction with the sortBy query parameter. |
sortBy | Sorts answers by date created. | string | Optional | Must be used in conjunction with the orderBy query parameter. |
debug | Adds the debug field with error notifications. | string | Optional | Option: true |
Request Samples
This request gets all the answers submitted by a specific user on the indicated survey.
curl --location --request GET 'https://www.cotalker.com/api/v2/answers?survey=61a50f928843af3e1332c67f&user=61953bf9bdc3558a4966e54d' \
--header 'Admin: true' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
Response Sample
Responses follow the COTAnswer data model.
Get an Answer by Id
Returns the answer indicated by the Id.
GET /answers/{id}Endpoint URL
https://www.cotalker.com/api/v2/answers/{id}
Path Parameters
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
id | Either the _id or _uuid_ of the answer that is to be returned. | ObjectId<COTAnswer> | Required |
Headers
Header | Description | Required | Values |
---|---|---|---|
Admin | Authorizes the use of the endpoint. | Required | true |
Authorization | Sends your access token to make an API request. Click here to see how to obtain an access token. | Required | Bearer $ACCESS_TOKEN |
Query Parameters
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
debug | Adds the debug field with error notifications. | string | Optional | Option: true |
Request Sample
curl --location --request GET 'https://www.cotalker.com/api/v2/answers/61a7c1df03ffa8e4ee2df904' \
--header 'Admin: true' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer $ACCESS_TOKEN'
Response Sample
The response follows the COTAnswer data model.