PUT: https://{{env}}.survey2connect.com/v2/api/surveys/{{survey_id}}/pages/{{page_id}}/questions/{{question_id}}

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 

Supported Request Payload

Field Type Mandatory Description
fieldOptions Object Yes Row and column elements for the questions:

  • row
  • col
title string yes Title of the question

Request Parameter

{{survey_id}}: Unique Survey ID.

{{page_id}}: Unique Page ID.

{{question_id}}: Unique Question ID.

Request Body

{ 
"fieldOptions": { 
"row": [ 
{ 
"option_settings": { 
"is_hidden": 1 
}, 
"_id": "625d38d0ad53bc667051eee3", 
"text": "sample" 
} 
] 
}, 
"title": "c" 
}  

Request Sample

curl --location --request PUT 'https://az1.survey2connect.com/v2/api/surveys/64a3d1ea92d2a762cd278299/pages/64a3d1ea92d2a762cd27829a/questions/64a5414dbe69661a9077c951' \
--header 'Authorization: Bearer eyJraWQiOiJzM3E1OWF2cFdIcXVKa0I0MjRpcFpqQVN0dXAzQzFkZEhVM3k2TjNZSXRjPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiI0Mepl3Kf6Bc0aD9hQsm77z7YQKD65VeTQh3bUK8yOpm94Hvg' \
--header 'Content-Type: application/json' \
--data-raw '{
    "fieldOptions": {
        "row": [
            {
                "option_settings": {
                    "is_hidden": 1
                },
                "_id": "64a3d1f862476b62c26d6191",
                "text": "sample"
            }
        ]
    },
    "title": "c"
}'
var myHeaders = new Headers(); 
myHeaders.append("Authorization", "Bearer eyJraWQiOiJzM3E1OWF2cFdIcXVKa0I0MjRpcFpqQVN0dXAzQzFkZEhVM3k2TjNZSXRjPSIsImFs”); 
myHeaders.append("Content-Type", "application/json"); 
  
var raw = JSON.stringify({ 
"fieldOptions":{ 
    "row": [
      {
        "option_settings": {
          "is_hidden": 1
        },
        "_id": "64a3d1f862476b62c26d6191",
        "text": "sample"
      }
    ]
  },
  "title": "c"
  }); 
  
var requestOptions = { 
  method: 'PUT', 
  headers: myHeaders, 
  body: raw, 
  redirect: 'follow' 
}; 
  
fetch("https://az1.survey2connect.com/v2/api/surveys/:survey_id/pages/:page_id/questions/:question_id", requestOptions) 
  .then(response => response.text()) 
  .then(result => console.log(result)) 
  .catch(error => console.log('error', error));   

Responses

{ 
"type": "multiChoice_radio", 
"description": "", 
"sur_id": "6489585843356d4d575e9734", 
"settings": { 
"is_hidden": 0, 
"required": true, 
"required_message": "This question requires an answer" 
}, 
"_id": "648c27aa0bb203f5adedf015", 
"modified": "Fri Jun 16 2023 14:43:14", 
"created": "Fri Jun 16 2023 14:43:14", 
"title": "c", 
"data": { 
"row": [ 
{ 
"option_settings": { 
"is_hidden": 0, 
"required": 0, 
"add_text": 0 
}, 
"_id": "648c27aa0bb203f5adedf016", 
"text": "Number of appliances"  
], 
"col": [], 
"upload": [] 
} 
}   
{ 
    "error": { 
        "name": "Unauthorized", 
        "message": "The authorization token was not provided." 
    } 
}  
{   
    "error": {   
         "name": "Internal Server Error",   
         "message": "We were not able to process your request"   
    }   
} 

Note: Please do not share your tokens in publicly accessible areas or to anyone. Also, this token generated is valid for 24 hours only. After its expiry, you can regenerate the access token from the same API endpoint by passing the username and password or from the refresh token API with the help of refresh token.

Get Question

GET : https://{{env}}.survey2connect.com/v2/api/surveys/{{survey_id}}/pages/{{page_id}}/questions/{{question_id}} The value of environment {{env}} variable depends upon your datacenter. Refer to the Environment page for more…

Create Question

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

Delete Question

DELETE: https://{{env}}.survey2connect.com/v2/api/surveys/{{survey_id}}/pages/{{page_id}}/questions/{{question_id}} 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?