Post /surveys/{{survey-id}}/analytics

Example Request

https://api.questionpro.{{env}}/a/api/v2/surveys/{{survey-id}}/analytics

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


Authorization

arrow_rightSecurity - API Key
Name : api-key
required
Location : Request Header
Type : string

Request Parameters

arrow_rightPath Parameters
survey-id integer
required

Request Body

arrow_rightPayload
application/json

                    {}
                    

Example Code

arrow_rightcURL
Snippet copied successfully.
application/json

curl --location 'https://api.questionpro.{{env}}/a/api/v2/surveys/{{survey-id}}/analytics' \
--header 'api-key: {{api-key}}' \
--header 'Content-Type: application/json' \
--data '{}
                
arrow_rightPython
Snippet copied successfully.
application/json

import requests
import json

url = "https://api.questionpro.{{env}}/a/api/v2/surveys/{{survey-id}}/analytics"

payload = json.dumps({})
headers = {
  'api-key': '{{api-key}}',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


                    
arrow_rightPHP - cURL
Snippet copied successfully.
application/json

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.questionpro.{{env}}/a/api/v2/surveys/{{survey-id}}/analytics',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{}
',
  CURLOPT_HTTPHEADER => array(
    'api-key: {{api-key}}',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

                    

Responses

arrow_rightExample
application/json

{
    "response": {
        "sections": [
            {
                "title": "Do you like streaming on US based OTT platforms in English language?",
                "questions": [
                    {
                        "type": "multiplechoice_radio",
                        "code": "Q1",
                        "totalCount": 5.0,
                        "averageScore": 0.0,
                        "percentageTotal": 100.0,
                        "highChartJSON": "{\"plotOptions\":{\"cursor\":\"pointer\",\"bar\":{\"colorByPoint\":true},\"series\":{\"dataLabels\":{\"connectorColor\":\"# 000000\",\"color\":\"# 000000\",\"format\":\"{point.truncatedDataLabelName} : {point.percentageValue:.2f}%\",\"enabled\":true},\"fillOpacity\":0.85,\"animation\":true},\"column\":{\"dataLabels\":{\"crop\":false,\"enabled\":true},\"borderWidth\":0,\"plotPadding\":0.20000000298023224,\"colorByPoint\":true},\"pie\":{\"dataLabels\":{\"style\":{\"width\":\"400px\"}},\"size\":\"80%\",\"allowPointSelect\":true,\"colorByPoint\":true}},\"yAxis\":{\"allowDecimals\":false,\"visible\":true,\"min\":0,\"max\":100,\"title\":{\"text\":\"\"}},\"exporting\":{\"enabled\":false},\"xAxis\":{\"categories\":[\"Yes\",\"No\"],\"title\":{\"text\":\"\"},\"labels\":{\"useHTML\":false,\"style\":{\"style\":{\"fontSize\":\"12px\"}}}},\"credits\":{\"enabled\":false},\"legend\":{\"enabled\":false},\"series\":[{\"data\":[{\"sliced\":true,\"truncatedName\":\"Yes\",\"visible\":true,\"name\":\"Yes\",\"y\":60,\"truncatedDataLabelName\":\"Yes\",\"percentageValue\":60,\"selected\":true},{\"truncatedName\":\"No\",\"visible\":true,\"name\":\"No\",\"y\":40,\"truncatedDataLabelName\":\"No\",\"percentageValue\":40}],\"name\":\"\"}],\"subtitle\":{\"text\":\"\"},\"tooltip\":{\"shared\":true,\"headerFormat\":\"<span style=\\\"font-size:10px\\\"><\/span><table>\",\"valueDecimals\":0,\"useHTML\":true,\"pointFormat\":\"<tr><td style=\\\"padding:0\\\"><b>{point.name} : {point.percentageValue:.2f}%<\/b><\/td><\/tr>\",\"footerFormat\":\"<\/table>\"},\"title\":{\"text\":\"\"},\"chart\":{\"renderTo\":\"123610961_1_1\",\"style\":{\"fontFamily\":\"Arial\"},\"type\":\"pie\",\"height\":400},\"colors\":[\"# 008fd3\",\"# 7D7D7D\"]}",
                        "required": false,
                        "answers": [
                            {
                                "title": "Yes",
                                "count": 3.0,
                                "percentage": 60.0
                            },
                            {
                                "title": "No",
                                "count": 2.0,
                                "percentage": 40.0
                            }
                        ],
                        "id": 123610961
                    }
                ]
            },
            {
                "title": "Which of the following features do you like about US based OTT platforms in English language?",
                "questions": [
                    {
                        "type": "multiplechoice_checkbox",
                        "code": "Q2",
                        "totalCount": 11.0,
                        "averageScore": 0.0,
                        "percentageTotal": 100.0,
                        "highChartJSON": "{\"plotOptions\":{\"cursor\":\"pointer\",\"bar\":{\"colorByPoint\":true},\"series\":{\"dataLabels\":{\"connectorColor\":\"# 000000\",\"color\":\"# 000000\",\"format\":\"{point.truncatedDataLabelName} : {point.percentageValue:.2f}%\",\"enabled\":true},\"fillOpacity\":0.85,\"animation\":true},\"column\":{\"dataLabels\":{\"crop\":false,\"enabled\":true},\"borderWidth\":0,\"plotPadding\":0.20000000298023224,\"colorByPoint\":true},\"pie\":{\"dataLabels\":{\"style\":{\"width\":\"400px\"}},\"size\":\"80%\",\"allowPointSelect\":true,\"colorByPoint\":true}},\"yAxis\":{\"allowDecimals\":false,\"visible\":true,\"min\":0,\"max\":100,\"title\":{\"text\":\"\"}},\"exporting\":{\"enabled\":false},\"xAxis\":{\"categories\":[\"Cost\",\"Quality\",\"Variety\",\"Ease of use\"],\"title\":{\"text\":\"\"},\"labels\":{\"useHTML\":false,\"style\":{\"style\":{\"fontSize\":\"12px\"}}}},\"credits\":{\"enabled\":false},\"legend\":{\"enabled\":false},\"series\":[{\"data\":[{\"truncatedName\":\"Cost\",\"visible\":true,\"name\":\"Cost\",\"y\":18.18,\"truncatedDataLabelName\":\"Cost\",\"percentageValue\":18.18},{\"sliced\":true,\"truncatedName\":\"Quality\",\"visible\":true,\"name\":\"Quality\",\"y\":27.27,\"truncatedDataLabelName\":\"Quality\",\"percentageValue\":27.27,\"selected\":true},{\"truncatedName\":\"Variety\",\"visible\":true,\"name\":\"Variety\",\"y\":27.27,\"truncatedDataLabelName\":\"Variety\",\"percentageValue\":27.27},{\"truncatedName\":\"Ease of use\",\"visible\":true,\"name\":\"Ease of use\",\"y\":27.27,\"truncatedDataLabelName\":\"Ease of use\",\"percentageValue\":27.27}],\"name\":\"\"}],\"subtitle\":{\"text\":\"\"},\"tooltip\":{\"shared\":true,\"headerFormat\":\"<span style=\\\"font-size:10px\\\"><\/span><table>\",\"valueDecimals\":0,\"useHTML\":true,\"pointFormat\":\"<tr><td style=\\\"padding:0\\\"><b>{point.name} : {point.percentageValue:.2f}%<\/b><\/td><\/tr>\",\"footerFormat\":\"<\/table>\"},\"title\":{\"text\":\"\"},\"chart\":{\"renderTo\":\"123610962_2_1\",\"style\":{\"fontFamily\":\"Arial\"},\"type\":\"pie\",\"height\":400},\"colors\":[\"# 7D7D7D\",\"# 008fd3\",\"# 7D7D7D\",\"# 7D7D7D\"]}",
                        "required": false,
                        "answers": [
                            {
                                "title": "Cost",
                                "count": 2.0,
                                "percentage": 18.18
                            },
                            {
                                "title": "Quality",
                                "count": 3.0,
                                "percentage": 27.27
                            },
                            {
                                "title": "Variety",
                                "count": 3.0,
                                "percentage": 27.27
                            },
                            {
                                "title": "Ease of use",
                                "count": 3.0,
                                "percentage": 27.27
                            }
                        ],
                        "id": 123610962
                    }
                ]
            },
            {
                "title": "Please provide your feedback about US based OTT platforms in English language",
                "questions": [
                    {
                        "type": "text_multiple_row",
                        "code": "Q3",
                        "totalCount": 0.0,
                        "averageScore": 0.0,
                        "percentageTotal": 0.0,
                        "required": false,
                        "answers": [
                            {
                                "count": 0.0,
                                "percentage": 0.0,
                                "id": 163870829,
                                "date": "05/14/2023",
                                "text": "The English content on US-based OTT platforms is exceptional. From award-winning series to critically acclaimed films, these platforms offer a vast collection that caters to diverse preferences. I particularly enjoy the ability to stream in high definition and even offline in some cases"
                            },
                            {
                                "count": 0.0,
                                "percentage": 0.0,
                                "id": 163870824,
                                "date": "05/14/2023",
                                "text": "Pricing is a concern with certain US-based OTT platforms. While they may have an extensive library of English content, the subscription fees can be quite high, making it less accessible for individuals on a tight budget."
                            },
                            {
                                "count": 0.0,
                                "percentage": 0.0,
                                "id": 163870823,
                                "date": "05/14/2023",
                                "text": "I've noticed that certain US-based OTT platforms have an overwhelming number of advertisements, which can disrupt the viewing experience and become frustrating, especially when trying to enjoy English language content"
                            },
                            {
                                "count": 0.0,
                                "percentage": 0.0,
                                "id": 163870817,
                                "date": "05/14/2023",
                                "text": "US-based OTT platforms excel in delivering high-quality English content. The streaming experience is seamless, and the platforms often offer user-friendly interfaces, making it enjoyable to browse and navigate through their extensive libraries."
                            },
                            {
                                "count": 0.0,
                                "percentage": 0.0,
                                "id": 163870811,
                                "date": "05/14/2023",
                                "text": "I find US-based OTT platforms to be incredibly diverse and engaging. The range of content available in English is impressive, allowing me to explore various genres and discover new shows and movies easily."
                            }
                        ],
                        "id": 123610963
                    }
                ]
            }
        ]
    },
    "requestID": "be6847851-3aa92-448a-90055-3457ni424fe984"
}
                    
arrow_rightSchema
application/json
{
  "$schema": "http://json-schema.org/draft-06/schema# ",
  "type": "object",
  "properties": {
    "response": {
      "type": "object",
      "properties": {
        "sections": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "questions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "answers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string"
                          },
                          "percentage": {
                            "type": "number"
                          },
                          "count": {
                            "type": "number"
                          },
                          "id": {
                            "type": "integer"
                          },
                          "text": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": false,
                        "required": [
                          "percentage",
                          "count"
                        ]
                      }
                    },
                    "highChartJSON": {
                      "type": "string"
                    },
                    "id": {
                      "type": "integer"
                    },
                    "type": {
                      "type": "string"
                    },
                    "totalCount": {
                      "type": "number"
                    },
                    "percentageTotal": {
                      "type": "number"
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "averageScore": {
                      "type": "number"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "code",
                    "answers",
                    "id",
                    "type",
                    "totalCount",
                    "percentageTotal",
                    "required",
                    "averageScore"
                  ]
                }
              },
              "title": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "required": [
              "questions",
              "title"
            ]
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "sections"
      ]
    },
    "requestID": {
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "response",
    "requestID"
  ]
}
arrow_right400 example
application/json

{
    "response": {
     "error": {
         "docs": www.questionpro.com/api/error-codes.html
         "name": "BAD_REQUEST",
         "httpStatusCode": 400,
         "id" : "1000",
         "message": "Invalid URL parameters",
         "resourceUrl":"resource_url"
        }
    }
}
                                
arrow_rightSchema
application/json

{
  "$schema": "http://json-schema.org/draft-06/schema#                                 ",
  "type": "object",
  "properties": {
    "response": {
      "type": "object",
      "properties": {
        "error": {
          "type": "object",
          "properties": {
            "docs": {
              "type": "string"
            },
            "resourceUrl": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "httpStatusCode": {
              "type": "integer"
            }
          },
          "additionalProperties": false,
          "required": [
            "docs",
            "resourceUrl",
            "name",
            "id",
            "message",
            "httpStatusCode"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "error"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "response"
  ]
}
                                
arrow_right401 example
application/json

{
    "response": {
     "error": {
         "docs": www.questionpro.com/api/error-codes.html
         "name": "UNAUTHORIZED",
         "httpStatusCode": 401,
         "id" : "1010",
         "message": "Incorrect API Key",
         "resourceUrl":"resource_url"
        }
    }
}
						
							
arrow_rightSchema
application/json

{
  "$schema": "http://json-schema.org/draft-06/schema#                                 ",
  "type": "object",
  "properties": {
    "response": {
      "type": "object",
      "properties": {
        "error": {
          "type": "object",
          "properties": {
            "docs": {
              "type": "string"
            },
            "resourceUrl": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "httpStatusCode": {
              "type": "integer"
            }
          },
          "additionalProperties": false,
          "required": [
            "docs",
            "resourceUrl",
            "name",
            "id",
            "message",
            "httpStatusCode"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "error"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "response"
  ]
}
                                
arrow_right403 example
application/json

{
    "response": {
     "error": {
         "docs": www.questionpro.com/api/error-codes.html
         "name": "FORBIDDEN",
         "httpStatusCode": 403,
         "id" : "1013",
         "message": "The user does not have permission to access the resource",
         "resourceUrl":"resource_url"
        }
    }
}				
							
arrow_rightSchema
application/json

{
  "$schema": "http://json-schema.org/draft-06/schema#                                 ",
  "type": "object",
  "properties": {
    "response": {
      "type": "object",
      "properties": {
        "error": {
          "type": "object",
          "properties": {
            "docs": {
              "type": "string"
            },
            "resourceUrl": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "httpStatusCode": {
              "type": "integer"
            }
          },
          "additionalProperties": false,
          "required": [
            "docs",
            "resourceUrl",
            "name",
            "id",
            "message",
            "httpStatusCode"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "error"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "response"
  ]
}
                                
arrow_right404 example
application/json

{
    "response": {
     "error": {
         "docs": www.questionpro.com/api/error-codes.html
         "name": "NOT_FOUND",
         "httpStatusCode": 404,
         "id" : "1040",
         "message": "The resource that you're trying to access doesn't exist",
         "resourceUrl":"resource_url"
        }
    }
}
							
							
arrow_rightSchema
application/json

{
  "$schema": "http://json-schema.org/draft-06/schema#                                 ",
  "type": "object",
  "properties": {
    "response": {
      "type": "object",
      "properties": {
        "error": {
          "type": "object",
          "properties": {
            "docs": {
              "type": "string"
            },
            "resourceUrl": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "httpStatusCode": {
              "type": "integer"
            }
          },
          "additionalProperties": false,
          "required": [
            "docs",
            "resourceUrl",
            "name",
            "id",
            "message",
            "httpStatusCode"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "error"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "response"
  ]
}
                                
arrow_right500 example
application/json

{
    "response": {
     "error": {
         "docs": www.questionpro.com/api/error-codes.html
         "name": "INTERNAL_SERVER_ERROR",
         "httpStatusCode": 500,
         "id" : "1026",
         "message": "We are not able to process your request",
         "resourceUrl":"resource_url"
        }
    }
}
							
arrow_rightSchema
application/json

{
  "$schema": "http://json-schema.org/draft-06/schema#                                 ",
  "type": "object",
  "properties": {
    "response": {
      "type": "object",
      "properties": {
        "error": {
          "type": "object",
          "properties": {
            "docs": {
              "type": "string"
            },
            "resourceUrl": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "httpStatusCode": {
              "type": "integer"
            }
          },
          "additionalProperties": false,
          "required": [
            "docs",
            "resourceUrl",
            "name",
            "id",
            "message",
            "httpStatusCode"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "error"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "response"
  ]
}
                                

Unsupported Question Types

arrow_rightBasic
Static Content - Presentation text, section heading, section sub-heading
Basic Matrix - Spreadsheet
arrow_rightAdvanced
Image / Multimedia: TubePulse, HeatMap
Health Care: Verified Signature
Data Reference: Store Locator, Custom Numeric Validator
Mobile: QR Code - Like/Dislike
Upload: Attach/Upload File, Signature, Live Cast
Logic: Custom Logic Engine
Misc: Page Timer