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.
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.
Prerequisites: 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 of 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. This should be captured for future use to indicate the row has been created by the user. The UUID for the row is also returned within the GET questions request, if you want to capture the ID for rows created by the user in the portal directly.
Guideline:
1. Rows can only be added to dynamic matrix questions ("isDynamic" = true)
2. When creating a row, two options are possible:
a. When row details are pre-set (“isPrepop" = true), then “rowId” must be specified in the request body as the ID of an existing row for within the question (See “Questionnaire: Questions > GET Request” section)
b. 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-prd.cdpgreenstar.net/response/questions/{questionId }/add-row
Headers/Variables
subscription-key (header): For an authorized user this is the primary/secondary subscription key.
organisation-id (header): A valid partner organization ID is required to get tagging details of a specific organization.
questionId (query parameter): The ID of the question you want to add the row to.
Body
When row details are pre-set (“isPrepop" = true), rowID should be specified:
{
"rowId": " f4b9433f-03c7-483d-856c-c5ba0b90d1a4"
}
When row details are not pre-set (“isPrepop" = false), then “rowId” should be “null”:
{
"rowId": null
}
Response
Field | Description | Format |
id | The UUID for the newly created row | string |
refId | Not in use | string |
complexQuestionId | The ID of the matrix question the row belongs too | string |
instanceId | Not in use | integer |
title | The name of the newly created row | string |
order | The position of the row within the matrix question | integer |
Field Table
Schema
{
"id": "string",
"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 been created using this endpoint or created in response portal by the disclosing organization.
URLs
Sandbox: https://api-pre.cdpgreenstar.net/asp/response/questions/delete-row/{rowId}
Production: https://api-prd.cdpgreenstar.net/response/questions/delete-row/{rowId}
Headers/Variables
subscription-key (header): For an authorized user this is the primary subscription key.
organisation-id (header): A valid partner organization ID is required to get tagging details of a specific organization.
rowId (query parameter): The ID of the row you want to delete.
Body
NULL
Response
Field Table
Field | Description | Format |
id | The UUID for the newly created row | string |
refId | Not in use | string |
complexQuestionId | The ID of the question the row belongs too | string |
instanceId | Not in use | integer |
title | The name of the newly created row | string |
order | The position of the row within the matrix question | integer |
Schema
{
"id": "string",
"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 only possible to edit a single question within the “question” namespace.
If you have not found the answer you were looking for, please contact your account manager who will be able to assist you further.