Views:

This article is for an API Partner to retrieve necessary information on the expressions (auto-calculations) within a questionnaire. 

 

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 

 

Headers/Variables 
subscription-key (header): For authorized user, the primary/secondary subscription key.
organisation-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 

Field 

Description 

Data Type 

id 

The UUID of the expression. This is shared across all organizations. 

string 

questionId 

The ID of the question that the expression belongs to. 

string 

rowId 

The ID of the row that the expression belongs to. 

string 

postfix 

List of the values to be used in the calculation and the operator to be applied between them. 

Standard question: 

[[Q1 ID], [Q2 ID], Operand] 

Matrix question: 

[[Q1 Parent ID, Q1 Row ID, Q1 ID], [Q2 Parent ID, Q2 Row ID, Q2 ID], Operand] 

 
Note: use JSON.parse to clean string 

string 

row 

If the expression is within a matrix question, then additional information about the row and parent question is included. Note: typically expressions are only applied within matrix questions. 

array 

leadingQuestionId 

The parent question ID of the question the expression belongs to. 

string 

 

Schema 

[{
        "id": "string",
        "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 

Field 

Description 

Data Type 

id 

The row ID 

string 

complexQuestionId 

The ID of the question the row is part of. 

string 

 

Schema 

[{
   …

"row": {
            "id": "string",
            "complexQuestionId": "string"
}

   …
}]
 

 

JSON Response Example 

Below is an example API response while calling the GET method for this endpoint. The data retrieved are the list of values that are used in a calculation and the operator that was used between them. 


[{

"id": "0cb712a0-9dcf-4eaa-a88f-71260b75c6d0",
 "questionId": "0dbf668c-8948-4322-a711-bf2cb3c97676",
 "rowId": "8e4c11a6-9708-42d6-be50-4006fd932c98",
"postfix": "[[\"338aa738-13cd-4a91-9417-5a846b8a21f4\",\"a3a4e7c4-141f-4b78-89ba-77e25cb385fd\",\"8023c04e-59b4-479a-a00f-559c0595afe1\"]]",
"row": {
     "id": "8e4c11a6-9708-42d6-be50-4006fd932c98",
     "complexQuestionId": "2ee9c07f-feb1-4028-ba77-13493169991d"
},
"leadingQuestionId": "2ee9c07f-feb1-4028-ba77-13493169991d"

}]
 ​​​​​​​

POST/PUT/DELETE Requests 

POST, PUT and DELETE requests are not implemented for this endpoint, preventing changes being made to a questionnaire’s expressions. 

 

If you have not found the answer you were looking for, please contact your account manager who will be able to assist you further. 

Add a comment