This article is for an API Partner integrating with the Disclosure API to update individual responses for disclosing organizations.
Contents
Summary
Returns information on the relevant sections, questions, rows and options within a questionnaire for the specified organization.
Pre-requisites: Valid subscription key and organization UUID of an associated disclosing organization, for the respective Disclosure API environment.
Note - Tag Matching: only the question data for a single organization can be extracted at one time, as such it is not possible to extract ALL questions in a single questionnaire at once. See "API Overview" section above for details on "Tag Matching" which controls which questions are returned in question list response.
Note - Dynamic Loading: As mentioned, it is not possible to pull an “entire” CDP questionnaire via the Disclosure API. This is because the questionnaires contain various pathways, which cannot all be selected by a single organization. As such, we recommend you DO NOT create a “master” copy of the questionnaire and instead work to ensure dynamic loading of each user’s question lists as needed.
GET Request
Details on how to send the request to the /questions endpoint and the response that is returned when a successful request is sent.
Note - Data Sync: To ensure that you have an accurate list of each Discloser’s questions, it is recommended that you allow your users to sync their question data whenever changes are made by the user in the CDP Portal. Changes made during the questionnaire setup process or due to new requests, will often require the question data be refreshed.
URLs
Sandbox: https://api.pre.cdpgreenstar.net/asp/response/questionnaire/questions
Production: https://api.cdp.net/response/questionnaire/questions
Headers/Variables
subscription-key (header): For authorized user, the subscription key.
organization-id (header): The UUID for the organization you are requesting the question list for response.
Body
NULL
Response
Note: all fieldnames throughout the API are formatted using camel casing.
Top Level: Questionnaire Details (n)
Contains high-level information about the questionnaire the specified organization is associated to.
Field table
Schema
"name: "string",
"scoringDeadline": "string",
"version": "string",
"sections": [{...}],
"endDate": "string",
Second Level: Section Details (n+1)
Returns information about the sections of the questionnaire associated with the specified organization.
Field table
Schema
...
"section": [{
"code": "string",
"description": "string",
"order": integer
"questions": [{...}],
"infoBlocks": [{...}]
Third Level: Question (n+2)
A question list of all the questions relevant to the specified organization’s disclosure.
Field table
Note - Variants: The different options for “variant” depend on the question type:
-
Grouped Options - controls what a user can select:
-
"SINGLE_GROUP_SINGLE_SELECT" - only a single option in a single group can be selected.
-
"SINGLE_GROUP_MULTI_SELECT" - multiple options can be selected within a single group.
-
"MULTI_GROUP_MULTI_SELECT" - multiple options can be selected across multiple groups.
-
-
Matrix - the formatting of how matrix questions are displayed in the CDP Portal.
-
“TABLE” - in table view format.
-
“TAB” - in a tabbed view layout (not currently used).
-
-
Numeric - formatting of numerical values in the CDP Portal.
-
“CURRENCY” - treated as a currency value.
-
”YEAR” - can only be a 4-integer whole number.
-
”DEFAULT” - any other number controlled by the validation rules.
-
Note - validationRules: The schema of validation is shown as below:
"validationRules":
"{\"limit\":null,\"lo\":null,\"hi\":null,\"decimals\":null,\"default\":null,\" numberOfAttachments\":null,\"minDate\":null,\"maxDate\":null}",
-
“limit”: Maximum number of characters.
-
“lo” : Lowest Numerical value of the answer.
-
“hi”: Highest Numerical value of the answer.
-
“decimals”: Decimal places.
-
“default”: The default value of the answer.
-
“numberOfAttachments” : Number of attachments permitted.
-
“minDate”: Minimum date requirement.
-
“maxDate”: Maximum date requirement.
Schema
...
"questions": [{
"type": "string",
"tags": [{…}],
"options": [{…}],
}]
...
Fourth Level: Options (n+3)
An options list of all the options relevant to the specified organizations Discloser.
Known Issue - Whitespace: When retrieving the option names from the JSON response, you will notice that some of the names contain a single space character at the start and/or end of the string.
Field table
Note - Ordering: In the current version of the API the ordering of the options is not shared. As such, you will not be able to recreate the lists in the exact order as they might appear in the CDP Portal. It is recommended that you sort them alphabetically or however you think best.
Schema
...
"options": [{
}]
...
Fourth Level: Option Groups (n+3) [Grouped Questions only]
This section is only relevant for Grouped Options type questions: An options list of all the options within the option group structure relevant to the specified organization's disclosure.
Field table
Note - Ordering: In the current version of the API the ordering of the specific options is not shared. As such, you will not be able to recreate the lists in the exact order as they might appear in the CDP Portal. It is recommended that you sort them alphabetically or however you think best.
Schema
...
"options": [{
}]
...
Fourth Level: Tags (n+3)
A tag list of all the tags associated to each question in the questionnaire.
Note - Different Fields: In the response JSON you will see two tag attributes: “questionTags” and “tags”. The below section refers to the “tags” attribute only as this contains the more relevant information for the API integration.
Field table
Schema
...
"tags": [{
}]
...
Fourth Level: Rows (n+3) [Matrix Questions only]
This section is only relevant for Matrix type questions: A list of the rows that exist within the matrix question structure.
Note - Rows: As rows are added/removed to/from a matrix question (either via the API or CDP Portal) the row list returned by the /questions endpoint here will change accordingly. If you retrieve this data before the questionnaire-response has been updated, then you will only see the pre-set rows created by CDP as part of the questionnaire structure.
Field table
Note: for dyanmic questions, if instance ID is missing then the row is pre-populated. If instance ID is present, then the row is user created. However, whenever a row is created via the API the ID should be captured.
Schema
...
"rows": [{
}]
...
Fourth Level: Columns (n+3) [Matrix Questions only]
This section is only relevant for Matrix type questions: A list of the columns (or child questions) that exist within the matrix question structure.
Note - Columns: The structure here is essentially a copy of the 3rd level questions data (shared above), the differences are that type cannot be “MATRIX” as you cannot have a matrix question within another matrix question. And some of the matrix specific fields are therefore not included.
Field table
Schema
...
"columns": [{
"type": "string",
"tags": [{…}],
"options": [{…}],
}]
...
Error Handling
1. Invalid Subscription Key
When an incorrect or invalid subscription key is entered, the following error is displayed:
2. Invalid Organization ID
When an incorrect or invalid organization key is entered, the following error is displayed:
POST/PUT/DELETE Requests
POST, PUT and DELETE requests are not implemented for this endpoint, preventing changes being made to a Discloser’s questionnaire structure.
If you have not found the answer you were looking for, please contact your Account Manager who will be able to assist you further.
