Saltar al contendio prinicipal

Survey Chats

Advertencia

Esta página aún no se encuentra traducida al español.

Overview

Survey chats represent a survey's components and hold together the questions that make up each specific component in a survey.

additional resources

These are just some of the most basic API requests. For a complete list of endpoints, consult our API documentation on Swagger.

Get Survey Chats

Returns all survey chats within the company.

GET /surveychats

Endpoint URL

https://www.cotalker.com/api/v2/surveychats

Headers

HeaderDescriptionRequiredValues
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN

Query Parameters

ParameterDescriptionTypeRequiredNotes
limitLimits the amount of survey chats returned in the response.numberOptionalBy default, the limit is set to 10.
pageMakes the response display data from the indicated page number.numberOptionalBest used in combination with the "limit" parameter.
countAdds the counter field with the total amount of survey chats within the company.booleanOptional
surveyReturns survey chats that correspond to the indicated survey.ObjectId<COTSurvey>[ ]
idsReturns survey chats with the IDs indicated in the array.ObjectId<COTSurveyChats>[ ]Optional
modifiedReturns survey chats with the indicated modification date in the modifiedAt field.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
modified_gtReturns survey chats modified after the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
modified_gteReturns survey chats with a value in the modifiedAt field equal to or greater than the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
modified_ltReturns survey chats modified before the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
modified_lteReturns survey chats with a value in the modifiedAt field equal to or less than the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
isActiveReturns survey chats according to their isActive status.stringOptionalOptions are: all, true, false
debugAdds the debug field with error notifications.stringOptionalOption: true

Request Samples

This default request gets all the survey chats in the company.

curl --location --request GET 'https://www.cotalker.com/api/v2/surveychats' \
--header 'Authorization: Bearer $ACCESS_TOKEN'

Response Sample

Responses follow the COTSurveyChat data model.


Get a Survey Chat by Id

Returns the survey chat indicated by the Id.

GET /surveychats/{id}

Endpoint URL

https://www.cotalker.com/api/v2/surveychats/{id}

Path Parameters

ParameterDescriptionTypeRequiredNotes
idThe ObjectId of the survey chat that is to be returned.ObjectId<COTSurveyChat>Required

Headers

HeaderDescriptionRequiredValues
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN

Query Parameters

ParameterDescriptionTypeRequiredNotes
debugAdds the debug field with error notifications.stringOptionalOption: true

Request Sample

curl --location --request GET 'https://www.cotalker.com/api/v2/surveychats/61a5ee4b54951757297e38de' \
--header 'Authorization: Bearer $ACCESS_TOKEN'

Response Sample

The response follows the COTSurveyChat data model.


Create a New Survey Chat

Creates a new survey chat within a survey.

POST /surveychats

Endpoint URL

https://www.cotalker.com/api/v2/surveychats

Headers

HeaderDescriptionRequiredValues
AdminGrants administrative access to create a new survey chat.Requiredtrue
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN
Content-TypeIndicates the body's format.Requiredapplication/json

Query Parameters

ParameterDescriptionTypeRequiredNotes
debugAdds the debug field with error notifications.stringOptionalOption: true

Request Body

Only required fields are listed below. For a complete schema description, please go to the COTSurvey data model. Unrequired fields that are not submitted are either filled in automatically or left blank.

ElementDescriptionTypeRequiredNotes
contentTypeIndicates the content typestringRequiredDefault value: application/vnd.cotalker.survey
orderIndicates the represented question's place on the survey formnumberRequiredLower numbers are higher on top
senderIndicates origin string RequiredOptions: #system, #user
surveyIndicates the survey the question corresponds toObjectId<COTSurvey>Survey data modelRequired

Request Sample

Survey chat created with the minimum required fields:

curl --location --request POST 'https://www.cotalker.com/api/v2/surveychats' \
--header 'Admin: true' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"survey": "61a50f928843af3e1332c67f",
"sender": "#user",
"order": 10,
"contentType": "application/vnd.cotalker.survey"
}'

Response Sample

Go to COTSurveyChat for a complete description of the response.

{
"content": "",
"contentArray": [],
"isActive": true,
"isSystemModel": false,
"_id": "61a5f3b86b2d27160918dc37",
"survey": "61a50f928843af3e1332c67f",
"sender": "#user",
"order": 10,
"contentType": "application/vnd.cotalker.survey",
"modifiedAt": "2021-11-30T09:43:07.667Z",
"__v": 0
}

Update a Survey Chat

Updates or edits an existing survey chat.

PATCH /surveychats/{id}

Endpoint URL

https://www.cotalker.com/api/v2/surveychats/{id}

Path Parameters

ParameterDescriptionTypeRequiredNotes
idThe ObjectId of the survey chat that is to be modified.ObjectId<COTSurveyChat>Required

Headers

HeaderDescriptionRequiredValues
AdminGrants administrative access to modify a survey chat.Requiredtrue
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN
Content-TypeSets the body's format.Requiredapplication/json

Query Parameters

ParameterDescriptionTypeRequiredNotes
debugAdds the debug field with error notifications.stringOptionalOption: true

Request Body

Only the fields that are being updated or added are required to be put into the body. For a complete schema description, please go to the COTSurveyChat data model.

Request Sample

This sample adds two questions into the contentArray field:

curl --location --request PATCH 'https://www.cotalker.com/api/v2/surveychats/61a5f3b86b2d27160918dc37?debug=true' \
--header 'Admin: true' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"contentArray" : [
"61436eb4dd1e5af41302eab6",
"61436eb4dd1e5a1e8302eab7"
]
}'

Response Sample

Go to COTSurveyChat for a complete description of the response.

{
"content": "",
"contentArray": [
"61436eb4dd1e5af41302eab6",
"61436eb4dd1e5a1e8302eab7"
],
"isActive": true,
"isSystemModel": false,
"_id": "61a5f3b86b2d27160918dc37",
"survey": "61a50f928843af3e1332c67f",
"sender": "#user",
"order": 10,
"contentType": "application/vnd.cotalker.survey",
"modifiedAt": "2021-11-30T09:53:38.142Z",
"__v": 1
}