POST: https://{{env}}.survey2connect.com/v2/api/surveys/{{surId}}/response-count

The value of environment {{env}} variable depends upon your datacenter. Refer to the Environment page for more details.

"Content-Type": "application/json"
type: Api Key  
Key: x-api-key 
token: value from portal 

Request Parameters

{{surId}}: Unique Survey ID

Request Body

{
  "timeFilter": {
  "amount": 10,
  "period":"days",
  "type":"rolling"
},
  "resStatus": ["1"],
  "eData": {
  "City": "delhi"
}
}

Supported Filters

Field Type Mandatory Description
timeFilter Object No
Rolling Filter (e.g. Last 7 days, Last 3 months etc.)
{
   amount:7,
   period:"days/months/years"
   type:"rolling"
}
Before/After Time filter (e.g. before Nov 1st 2020, After July 15th 2020)
{
   operand: ["dd/mm/yyyy"]
   type: "before/after"
}
Relative Time Filter (e.g. Today, This Month, Last Month, Previous Year)
{
   amount: 7,
   period:  "day/week/month/year",
   type: "relative"
}
Between Time Filter (e.g. between July 15th 2020 & Nov 1st 2020)
{
   operand:  ["dd/mm/yyyy","dd/mm/yyyy"]
   type:"between"
}
resStatus Array No
Integer(0-2)
0 : Incomplete/Partial Responses
1: Complete Responses
2 : Disqualified Responses
collectorIds Array No
Array of collector ids
eData Object No
Key value pair of any custom variables

Request Sample

curl --location --request POST 'https://az1.survey2connect.com/v2/api/surveys/6368975d8f142e56a6557ccb/response-count' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiJzM3E1OWF2cFdIcXVKa0I0MjRpcFpqQVN0dXAzQzFkZEhVM3k2TjNZSXRjPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiI0MTIxMDc1NC01ODVkLTRjNmQtODc2NC02Mzg0NzJkYTRhODEiLCJ6b25laW5mbyI6InByb2RfYXoxIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImN1c3RvbTpwYXNzd29yZFRvQmVSZXNldCI6ImZhbHNlIiwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLmFwLXNvdXRoLTEuYW1hem9uYXdzLmNvbVwvYXAtc291dGgtMV9zalNzc2JrOXYiLCJwaG9uZV9udW1iZXJfdmVyaWZpZWQiOmZhbHNlLCJjdXN0b206dUlkIjoiNjExYmEzNTcwZjdhNDEyNDYxM2MyMzg2IiwiY29nbml0bzp1c2VybmFtZSI6IjQxMjEwNzU0LTU4NWQtNGM2ZC04NzY0LTYzODQ3MmRhNGE4MSIsImF1ZCI6Ijg1azh1b2RqODBpazUzb2F0cDRycWJsYmMiLCJldmVudF9pZCI6IjE1NWYzNDA5LTkxOTQtNGIwOC05NzI1LTk1ZjEyOTViMGRjMSIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjY5MTgzOTQ3LCJjdXN0b206c3RhdHVzIjoiYWN0aXZlIiwibmFtZSI6IlRlc3QgRCIsInBob25lX251bWJlciI6Iis5MTc0MTc0NjExNzYiLCJleHAiOjE2NjkyNzAzNDcsImN1c3RvbTpyb2xlIjoiYnJhbmRBZG1pbiIsImlhdCI6MTY2OTE4Mzk0NywiZW1haWwiOiJkYXZpbmRlci5zQHN1cnZleTJjb25uZWN0LmNvbSJ9.TCnoiWVPKpMQq9ygME2y-arC653tbTu8Rpm6ziyWDjAhkfiEP42LiGYPAOHJrPb_G5AzGlbKeKeDhx7DCKKGb9ZVg36ltiCOH3KapscL2PB_6qeKDXZfGTDUjUqxVjsuFXeLVGRIUpmgEjQq3f8lnKLEBHPspwvbxZ7jcSuk9BAO2VDAtdPulmiYF7NhfBQ2xXdpYaJiJxJPkdz-vZfvofRITKTu8XgozT0IRTHJ5lP3yYLc9asDflYNs-np2g4bwn8St_lEOT6abhOpoH6DpHT1yNaP7w1zQ3U0lXCaZ4imGp7ETZ5kYpuRMuJ8bINUCZHyi8uQF-rZkv6Fk6-Gmg' \
--data-raw '{
"timeFilter": {
"amount": 10,
"period":"days",
"type":"rolling"
},
"resStatus": ["1"],
"eData": {
"City": "delhi"
}
}'
var myHeaders = new Headers(); 
myHeaders.append("Authorization", "Bearer eyJraWQiOiJzM3E1OWF2cFdIcXVKa0I0MjRpcFpqQVN0dXAzQzFkZEhVM3k2TjNZSXRjPSIsImFs”); 
myHeaders.append("Content-Type", "application/json"); 
var raw = JSON.stringify({ 
  "timeFilter": { 
    "amount": 10, 
    "period": "days", 
    "type": "rolling" 
  }, 
  "resStatus": [ 
    "1" 
  ], 
  "eData": { 
    "city": "delhi" 
  } 
}); 
var requestOptions = { 
  method: 'POST', 
  headers: myHeaders, 
  body: raw, 
  redirect: 'follow' 
}; 
fetch("https://az1.survey2connect.com/v2/api/surveys/63281de56d497d12b49199c1/response-count", requestOptions) 
  .then(response => response.text()) 
  .then(result => console.log(result)) 
  .catch(error => console.log('error', error));  

Responses

{ 
    "response_count": 6 
} 
{ 
    "error": { 
        "name": "Unauthorized", 
        "message": "The authorization token was not provided." 
    } 
} 
{   
    "error": {   
         "name": "Internal Server Error",   
         "message": "We were not able to process your request"   
    }   
} 

Get Responses (CSV format)

POST: https://{{env}}.survey2connect.com/v2/api/surveys/{{surId}}/responses/csv The value of environment {{env}} variable depends upon your datacenter. Refer to the Environment page for more details.…

Get Responses (JSON Format)

POST: https://{{env}}.survey2connect.com/v2/api/surveys/{{surId}}/responses/json The value of environment {{env}} variable depends upon your datacenter. Refer to the Environment page for more details.…

Get Responses (SPSS format)

POST: https://{{env}}.survey2connect.com/v2/api/surveys/{{surId}}/responses/spss The value of environment {{env}} variable depends upon your datacenter. Refer to the Environment page for more details.…

Ask a human

Can't Find What You're Looking For?