Submit Answers
For the user to submit answers for a questionnaire and an asset, the following POST request can be used:
https://pistis-market.eu/srv/intention-analytics/api/questionnaire/:id/:version/answers
The id parameter should be the id of the questionnaire (e.g db469342-d725-4d20-b06d-0ffa6feaeb76), and the version its version (e.g 3).
Request body
{
"assetId": "bf5bdf5e-8d58-4a9b-b0fd-62394ebea655", // asset id that the user submits answers for
"responses": [
{
"questionId": "74c627ec-96c9-41a5-90ad-8bdcadd8abfe",
"questionTitle": "Question text",
"text": "Test Response"
},
{
"questionId": "bc88d655-5684-4645-8c99-aa3e2f81b43e",
"questionTitle": "Checkbox question",
"options": ["Option 1", "Option 2"]
}
]
}
Request Body Notes
- The
responsesproperty includes all the responses that the user is submitting (1 entry for each question answered)- The
optionsandtextproperties are both optional. Which one will be filled in the request body depends on the type of question (textfor Text questions,optionsforCheckboxandRadio Button)
- The
Server Response
Upon successful creation, the server will return an object containing the submitted responses and other details.
Example of the response:
{
"id": "209a19d6-7648-40de-82c0-928d0990cf32",
"responses": [
{
"questionId": "74c627ec-96c9-41a5-90ad-8bdcadd8abfe",
"questionTitle": "Question text",
"text": "Test Response"
},
{
"questionId": "bc88d655-5684-4645-8c99-aa3e2f81b43e",
"questionTitle": "Checkbox question",
"options": ["Option 1", "Option 2"]
}
],
"userId": "06352836-251e-4eaa-9990-5e252f0c0364",
"assetId": "bf5bdf5e-8d58-4a9b-b0fd-62394ebea655",
"questionnaire": {
"id": "a6b613ac-0fc9-42d7-b59d-80e69c369c97",
"version": "6",
"creatorId": "1234",
"isForVerifiedBuyers": true,
"title": "Questionnaire Test XYZ - Verified Buyers",
"description": "new questionnaire",
"isActive": true,
"publicationDate": "2024-08-09T12:21:35.695Z",
"createdAt": "2024-06-12T13:30:15.451Z",
"updatedAt": "2024-08-09T12:21:35.698Z"
},
"createdAt": "2024-08-09T12:30:45.728Z"
}
Table of Contents
