Update questionnaire (one shot)
curl --request PUT \
--url http://localhost:8081/protocols/{id}/questionnaire \
--header 'Content-Type: application/json' \
--data '
{
"formId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"questions": [
{
"questionText": "<string>",
"metadata": {},
"required": true,
"weight": 123,
"position": 123,
"options": [
{
"optionText": "<string>",
"score": 123,
"position": 123
}
]
}
],
"scoreRanges": [
{
"minScore": 123,
"maxScore": 123,
"classification": "<string>"
}
],
"name": "<string>",
"prompt": "<string>"
}
'const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
formId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
questions: [
{
questionText: '<string>',
metadata: {},
required: true,
weight: 123,
position: 123,
options: [{optionText: '<string>', score: 123, position: 123}]
}
],
scoreRanges: [{minScore: 123, maxScore: 123, classification: '<string>'}],
name: '<string>',
prompt: '<string>'
})
};
fetch('http://localhost:8081/protocols/{id}/questionnaire', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:8081/protocols/{id}/questionnaire"
payload = {
"formId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"questions": [
{
"questionText": "<string>",
"metadata": {},
"required": True,
"weight": 123,
"position": 123,
"options": [
{
"optionText": "<string>",
"score": 123,
"position": 123
}
]
}
],
"scoreRanges": [
{
"minScore": 123,
"maxScore": 123,
"classification": "<string>"
}
],
"name": "<string>",
"prompt": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"protocol": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"institutionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"prompt": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"form": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocolId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"questions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocolFormId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"questionText": "<string>",
"metadata": {},
"required": true,
"weight": 123,
"position": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"options": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocolQuestionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"optionText": "<string>",
"score": 123,
"position": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
]
}
}Update questionnaire (one shot)
Updates protocol name/prompt and replaces the form’s questions and score ranges. Send formId + full questions and scoreRanges. UI: single form, submit once.
PUT
/
protocols
/
{id}
/
questionnaire
Update questionnaire (one shot)
curl --request PUT \
--url http://localhost:8081/protocols/{id}/questionnaire \
--header 'Content-Type: application/json' \
--data '
{
"formId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"questions": [
{
"questionText": "<string>",
"metadata": {},
"required": true,
"weight": 123,
"position": 123,
"options": [
{
"optionText": "<string>",
"score": 123,
"position": 123
}
]
}
],
"scoreRanges": [
{
"minScore": 123,
"maxScore": 123,
"classification": "<string>"
}
],
"name": "<string>",
"prompt": "<string>"
}
'const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
formId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
questions: [
{
questionText: '<string>',
metadata: {},
required: true,
weight: 123,
position: 123,
options: [{optionText: '<string>', score: 123, position: 123}]
}
],
scoreRanges: [{minScore: 123, maxScore: 123, classification: '<string>'}],
name: '<string>',
prompt: '<string>'
})
};
fetch('http://localhost:8081/protocols/{id}/questionnaire', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:8081/protocols/{id}/questionnaire"
payload = {
"formId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"questions": [
{
"questionText": "<string>",
"metadata": {},
"required": True,
"weight": 123,
"position": 123,
"options": [
{
"optionText": "<string>",
"score": 123,
"position": 123
}
]
}
],
"scoreRanges": [
{
"minScore": 123,
"maxScore": 123,
"classification": "<string>"
}
],
"name": "<string>",
"prompt": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"protocol": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"institutionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"prompt": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"form": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocolId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"questions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocolFormId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"questionText": "<string>",
"metadata": {},
"required": true,
"weight": 123,
"position": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"options": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocolQuestionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"optionText": "<string>",
"score": 123,
"position": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
]
}
}Path Parameters
Protocol UUID
Body
application/json
⌘I