Create question
curl --request POST \
--url http://localhost:8081/protocols/{id}/forms/{formId}/questions \
--header 'Content-Type: application/json' \
--data '
{
"questionText": "<string>",
"metadata": {},
"required": true,
"weight": 1,
"position": 0
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({questionText: '<string>', metadata: {}, required: true, weight: 1, position: 0})
};
fetch('http://localhost:8081/protocols/{id}/forms/{formId}/questions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:8081/protocols/{id}/forms/{formId}/questions"
payload = {
"questionText": "<string>",
"metadata": {},
"required": True,
"weight": 1,
"position": 0
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocolFormId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"questionText": "<string>",
"responseType": "TEXT",
"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"
}
]
}Create question
POST
/
protocols
/
{id}
/
forms
/
{formId}
/
questions
Create question
curl --request POST \
--url http://localhost:8081/protocols/{id}/forms/{formId}/questions \
--header 'Content-Type: application/json' \
--data '
{
"questionText": "<string>",
"metadata": {},
"required": true,
"weight": 1,
"position": 0
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({questionText: '<string>', metadata: {}, required: true, weight: 1, position: 0})
};
fetch('http://localhost:8081/protocols/{id}/forms/{formId}/questions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:8081/protocols/{id}/forms/{formId}/questions"
payload = {
"questionText": "<string>",
"metadata": {},
"required": True,
"weight": 1,
"position": 0
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocolFormId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"questionText": "<string>",
"responseType": "TEXT",
"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"
}
]
}Body
application/json
Response
201 - application/json
Created question
Available options:
TEXT, NUMBER, DATE, DATETIME, BOOLEAN, SELECT, MULTIPLE_SELECT Type-specific config (e.g. dateFormat, minValue/maxValue)
Show child attributes
Show child attributes