This article is for an API Partner wanting to add or delete rows in a matrix question as part of updating a Discloser’s questionnaire-response.
Contents
Summary
This endpoint allows API Partners to interact with the rows within matrix questions. Rows can only be added to dynamic matrix questions, and then, those rows can be deleted later on.
Pre-requisites: Valid subscription key, organization UUID and question ID (adding of row) OR row ID (deleting of row) for the respective Disclosure API environment.
PUT Request (Adding a Row)
Details how to add a row to a dynamic matrix question within a Discloser’s questionnaire response.
Note – Row ID: When a row has been created using the PUT request then the UUID for the new row is returned as part of the success response message.
Note:
-
To be able to assign responses to the corresponding row, the rowID must be captured.
-
Only rows that have been created by the user can be deleted.
To find rows created by users in the Portal, the corresponding UUID for the row can be found calling GET - questions request.
Guideline:
-
Rows can only be added to dynamic matrix questions ("isDynamic" = true).
-
When creating a row, two options are possible:
-
When row details are pre-set (“isPrepop" = true), then “rowId” must be specified in the request body as the ID of an existing row within the question (SeeQuestionnaire: Questions > GET Request section).
-
When row details are not pre- set (“isPrepop" = false), then “rowId” in the request body should be “null”.
-
URLs
Sandbox: https://api.pre.cdpgreenstar.net/asp/response/questions/{questionId }/add-row
Production: https://api.cdp.net/response/questions/{questionId }/add-row
Headers/Variables
subscription-key (header): For an authorized user this is the subscription key.
organization-id (header): A valid partner organization ID is required.
questionId (query parameter) : The ID of the matrix question you want to add the row to.
Body
When row details are pre-set (“isPrepop" = true), rowID should be specified:
When row details are pre-set (“isPrepop" = false), then “rowId” should be “null”:
Response
Field table
Schema
"refId": null,
"complexQuestionId": "string",
"instanceId": 0,
"title": "string",
"order": 0
DEL Request
Details how to delete a row from a dynamic matrix question within a Discloser’s questionnaire response.
Note – Deletion of rows: You can only delete the rows that have been created using this endpoint or created in the customer Portal by the disclosing organization.
URLs
Sandbox: https://api.pre.cdpgreenstar.net/asp/response/questions/delete-row/{rowId}
Production: https://api.cdp.net/response/questions/delete-row/{rowId}
Headers/Variables
subscription-key (header): For an authorized user this is the subscription key.
organization-id (header): A valid partner organization ID is required.
rowId (query parameter) : The ID of the row you want to delete.
Body
NULL
Response
Field table
Note: The order may be affected if a row has been deleted. E.g. 10 rows created and row 4 is deleted the order won’t be updated, instead it will show 1, 2, 3, 5, 6… etc.
Schema
"refId": null,
"complexQuestionId": "string",
"instanceId": 0,
"title": "string",
"order": 0
GET/POST Requests
GET requests are not implemented for this endpoint as the information is provided in the responses and for all questions via the /questionnaire/questions endpoint.
POST requests are not implemented for this endpoint as it is not possible to edit rows once they have been created.
If you have not found the answer you were looking for, please contact your Account Manager who will be able to assist you further.
