This article is for an API Partner to retrieve necessary information on the expressions (auto-calculations) within a questionnaire.
Contents
Summary
Auto calculation expressions for a question can be retrieved using the GET request from this endpoint. These expressions show the formulas required when a calculation exists between two or more questions (e.g. Q3 = Q1 * Q2).
Pre-requisites: Valid subscription key and organization UUID for the respective Disclosure API environment.
Note - Data Sync: To ensure retrieval of accurate data, it is essential to refresh this request each time a republishing of the questionnaire is done. Your account manager will inform you if any such changes occur during the cycle.
GET Request
Details how to send the request to the questionnaire/expressions endpoint and the response that is returned when a successful request is sent.
URLs
Sandbox: https://api-pre.cdpgreenstar.net/asp/response/questionnaire/expressions
Production: https://api.cdp.net/response/questionnaire/expressions
Headers/Variables
subscription-key (header): For authorized user, the primary/secondary subscription key.
organization-id (header): Enter the UUID for the organization’s response.
Body
NULL
Response
Top Level: Expression (n)
Information regarding the auto-calculations included within the given questionnaire structure.
Note: The response from this endpoint is not controlled by Tag Matching. All expressions, for an entire questionnaire, are returned each time regardless of whether they are relevant to the provided disclosing organization.
Field table
Schema
"questionId": "string",
"rowId": "string",
"postfix": "string",
"row": [{...}],
"leadingQuestionId": "string"
Second Level: row (n+1)
Additional information about the row and matrix question that the expression belongs to, if applicable.
Field table
Schema
...
"row": {
"complexQuestionID": "string",
}
}]
JSON Response Example
"questionId": "4412c72f-922f-4241-894f-4302862bc641",
"rowId": "00fcaf8e-530d-4ac7-924e-8cbe4a38d5cc",
"postfix": "[[\"1491b888-7468-4c3a-a4bb-d09bd3a714b7\",\"00fcaf8e-530d-4ac7-924e-8cbe4a38d5cc\",\"1f7f991c-48fa-4896-896c-db8a3e5c6c66\"],[\"1491b888-7468-4c3a-a4bb-d09bd3a714b7\",\"00fcaf8e-530d-4ac7-924e-8cbe4a38d5cc\",\"bde02880-4283-4ce7-a325-38a2c585fbb2\"],\"+\",[\"1491b888-7468-4c3a-a4bb-d09bd3a714b7\",\"00fcaf8e-530d-4ac7-924e-8cbe4a38d5cc\",\"83662716-0947-4f1b-9f6b-4f1d148b403b\"],\"+\",[\"1491b888-7468-4c3a-a4bb-d09bd3a714b7\",\"00fcaf8e-530d-4ac7-924e-8cbe4a38d5cc\",\"9a0ccd39-8595-4ad2-851d-9d53ebd9ebdf\"],\"+\"]",
"id""00fcaf8e-530d-4ac7-924e-8cbe4a38d5cc",
"complexQuestionId""1491b888-7468-4c3a-a4bb-d09bd3a714b7"
Note: When three IDs are included within a single square bracket “[ ]”, it points to a single value within a matrix question. These IDs are “parentQuestionID”, “rowID”, “childQuestionID” respectively.
Error Handling
1. Invalid Subscription Key
When an incorrect or invalid subscription key is entered, the following error is displayed:
"name": "Unauthorized",
"link": 401
2. Invalid Organization ID
When an incorrect or invalid organization id is entered, the following error is displayed:
"name": "Unauthorized",
"link": 401
POST/PUT/DELETE Requests
POST, PUT and DELETE requests are not implemented for this endpoint, preventing changes being made to a questionnaire's response.
If you have not found the answer you were looking for, please contact your Account Manager who will be able to assist you further.
