https://api.questionpro.{{env}}/a/api/v2/surveys/{{survey-id}}/previous-page
The value of environment {{env}} variable depends upon your datacenter. Refer to the Environment page for more details.
Navigates the respondent back to the previous survey page. The response has the same shape as GET /take — it returns the previous page's questions with the answers the respondent previously submitted already embedded in the question JSON.
curl --location 'https://api.questionpro.{{env}}/a/api/v2/surveys/{{survey-id}}/previous-page' \
--header 'Accept: application/json' \
--header 'Cookie: JSESSIONID={{jsessionid}}'
import requests
url = "https://api.questionpro.{{env}}/a/api/v2/surveys/{{survey-id}}/previous-page"
headers = {
"Accept": "application/json"
}
# Use the same session object that was used for GET /take and POST /submit-page
session = requests.Session()
response = session.get(url, headers=headers)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.questionpro.{{env}}/a/api/v2/surveys/{{survey-id}}/previous-page',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Cookie: JSESSIONID={{jsessionid}}'
),
CURLOPT_COOKIEFILE => '/tmp/cookie.txt',
CURLOPT_COOKIEJAR => '/tmp/cookie.txt',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
const response = await fetch(
'https://api.questionpro.{{env}}/a/api/v2/surveys/{{survey-id}}/previous-page',
{
method: 'GET',
headers: { 'Accept': 'application/json' },
credentials: 'include' // forwards JSESSIONID cookie automatically
}
);
const data = await response.json();
console.log(data);
{
"response": {
"status": "success",
"meta": {
"isFinalPage": false,
"progressPercentage": 25
},
"navigation": {
"previousPageUrl": null,
"nextPageSubmitUrl": "/a/api/v2/surveys/123456/submit-page"
},
"themeConfig": {
"cssUrls": ["https://cdn.questionpro.com/themes/corporate.css"],
"jsUrls": []
},
"questions": [
{
"html": "<div class='qstn-row'>...rendered HTML with previously selected answer highlighted...</div>",
"json": "{\"id\":10001,\"type\":\"U\",\"text\":\"How satisfied are you with our service?\",\"answers\":[{\"id\":50001,\"text\":\"Very satisfied\"},{\"id\":50002,\"text\":\"Satisfied\",\"selected\":true},{\"id\":50003,\"text\":\"Neutral\"}],\"formParam\":{\"paramPrefix\":\"u_\",\"paramIdType\":\"questionId\"}}"
}
]
},
"requestID": "7ab12cde-3f45-67gh-89ij-0k1lm2n3o4p5"
}
{
"$schema": "http://json-schema.org/draft-06/schema# ",
"type": "object",
"properties": {
"response": {
"type": "object",
"properties": {
"navigation": {
"type": "object",
"properties": {
"previousPageUrl": {
"type": "string"
},
"nextPageSubmitUrl": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"previousPageUrl",
"nextPageSubmitUrl"
]
},
"meta": {
"type": "object",
"properties": {
"isFinalPage": {
"type": "string"
},
"progressPercentage": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"isFinalPage",
"progressPercentage"
]
},
"questions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"json": {
"type": "string"
},
"html": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"json",
"html"
]
}
},
"themeConfig": {
"type": "object",
"properties": {
"jsUrls": {
"type": "string"
},
"cssUrls": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"jsUrls",
"cssUrls"
]
},
"status": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"navigation",
"meta",
"questions",
"themeConfig",
"status"
]
},
"requestID": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"response",
"requestID"
]
}
{
"response": {
"error": {
"docs": www.questionpro.com/api/error-codes.html
"name": "BAD_REQUEST",
"httpStatusCode": 400,
"id" : "1000",
"message": "Invalid URL parameters",
"resourceUrl":"resource_url"
}
}
}
{
"$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"
]
}
{
"error": {
"code": 1002,
"message": "No previous page to navigate back to."
},
"requestID": "7ab12cde-3f45-67gh-89ij-0k1lm2n3o4p5"
}
{
"response": {
"error": {
"docs": www.questionpro.com/api/error-codes.html
"name": "BAD_REQUEST",
"httpStatusCode": 400,
"id" : "1000",
"message": "Invalid URL parameters",
"resourceUrl":"resource_url"
}
}
}
{
"$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"
]
}
{
"response": {
"error": {
"docs": www.questionpro.com/api/error-codes.html
"name": "UNAUTHORIZED",
"httpStatusCode": 401,
"id" : "1010",
"message": "Incorrect API Key",
"resourceUrl":"resource_url"
}
}
}
{
"$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"
]
}
{
"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"
}
}
}
{
"$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"
]
}
{
"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"
}
}
}
{
"$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"
]
}
{
"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"
}
}
}
{
"$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"
]
}