Reference Aidbox Forms reference Aidbox SDC API Custom SDC operations supported by Aidbox Forms.
Generate a link to a QuestionnaireResponse - $generate-link
This operation generates a link to a web page to be used to continue answering a specified QuestionnaireResponse .
URLs
Copy POST [base]/QuestionnaireResponse/[id]/$generate-link
Parameters
NOTE: All parameters wrapped with Parameters object
Copy resourceType: Parameters
parameter:
- name: [var-name]
value: [var-value]
allow-amend
Whether the generated link will allow amending and re-submitting the form.
Copy name: allow-amend
value:
Boolean: true
allow-repopulate
Whether the generated link will allow re-populating the form.
NOTE: Repopulate will be working only with forms that contain populate behavior
Copy name: allow-repopulate
value:
Boolean: true
redirect-on-submit
A URL where the user will be redirected to after successfully submitting the form.
Copy name: redirect-on-submit
value:
String: https://example.com/submit-hook?questionnaire=123
redirect-on-save
A URL where the user will be redirected to after hitting Save button.
By default Save button is not visible
- form autosaved after every keystroke. But sometimes it's usefull to close form in a partially-filled state
Copy name: redirect-on-save
value:
String: https://example.com/submit-hook?questionnaire=123
expiration
Link expiration period (days)
Copy name: expiration
value:
Integer: 30
By default thir parameter = 7 days
theme
Form theme.
Copy name: theme
value:
String: hs-theme
read-only
Show form in a read-only mode
Copy name: read-only
value:
Boolean: true
app-name
Application name that will be used in Audit logging when returned link was used.
Audit logging should be enabled via configuartion
Copy - name: app-name
value
String: my-app
Usage Example
Request Success Response Failure Response
Copy POST [base]/QuestionnaireResponse/[id]/$generate-link
content-type: text/yaml
resourceType: Parameters
parameter:
- name: allow-amend
value:
Boolean: true
- name: redirect-on-submit
value:
String: https://example.com/submit-hook?questionnaire=123
HTTP status: 200
Copy link: http://forms.aidbox.io/ui/sdc#/questionnaire-response/12c1178c-70a9-4e02-a53d-65b13373926e?token=eyJhbGciOiJIUzI
HTTP status: 422
Copy resourceType: OperationOutcome
text:
status: generated
div: Parameters are invalid
issue:
- severity: error
code: invalid
expression:
- parameter.0.resource
diagnostics: unknown key :resource
Aidbox uses HS256 to sign JWT token by default. To use RS256 you need to set
BOX_AUTH_KEYS_PRIVATE
and BOX_AUTH_KEYS_PUBLIC
environment variables.
https://docs.aidbox.app/reference/configuration/environment-variables/optional-environment-variables#set-up-rsa-private-public-keys-and-secret
Save a QuestionnaireResponse - $save
This operation validates the structure of a QuestionnaireResponse and saves it. It performs basic structural validation but does not validate against the associated Questionnaire definition.
URLs
Copy POST [base]/QuestionnaireResponse/$save
Parameters
NOTE: All parameters wrapped with Parameters object
Copy resourceType: Parameters
parameter:
- name: response
resource:
# QuestionnaireResponse resource here
The operation takes a single input parameter named "response" containing a QuestionnaireResponse resource wrapped in a Parameters resource.
Output Parameters
The operation returns:
response : The saved QuestionnaireResponse resource
issues : Any validation issues encountered (if applicable)
Usage Example
Request Success Response Validation Failure Response
Copy POST [base]/QuestionnaireResponse/$save
content-type: application/fhir+json
{
"resourceType": "Parameters",
"parameter": [
{
"name": "response",
"resource": {
"resourceType": "QuestionnaireResponse",
"questionnaire": "Questionnaire/patient-registration",
"status": "in-progress",
"item": [
{
"linkId": "name",
"text": "Patient Name",
"item": [
{
"linkId": "name.given",
"text": "Given Name",
"answer": [
{
"valueString": "John"
}
]
},
{
"linkId": "name.family",
"text": "Family Name",
"answer": [
{
"valueString": "Smith"
}
]
}
]
}
]
}
}
]
}
HTTP status: 200
Copy {
"resourceType": "Parameters",
"parameter": [
{
"name": "response",
"resource": {
"resourceType": "QuestionnaireResponse",
"id": "12c1178c-70a9-4e02-a53d-65b13373926e",
"questionnaire": "Questionnaire/patient-registration",
"status": "in-progress",
"item": [
{
"linkId": "name",
"text": "Patient Name",
"item": [
{
"linkId": "name.given",
"text": "Given Name",
"answer": [
{
"valueString": "John"
}
]
},
{
"linkId": "name.family",
"text": "Family Name",
"answer": [
{
"valueString": "Smith"
}
]
}
]
}
]
}
}
]
}
HTTP status: 200
Copy {
"resourceType": "Parameters",
"parameter": [
{
"name": "response",
"resource": {
"resourceType": "QuestionnaireResponse",
"id": "12c1178c-70a9-4e02-a53d-65b13373926e",
"questionnaire": "Questionnaire/patient-registration",
"status": "in-progress",
"item": [
{
"linkId": "name",
"text": "Patient Name",
"item": [
{
"linkId": "name.given",
"text": "Given Name",
"answer": [
{
"valueString": "John"
}
]
},
{
"linkId": "name.family",
"text": "Family Name",
"answer": [
{
"valueString": "Smith"
}
]
}
]
}
]
}
},
{
"name": "issues",
"resource": {
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "required",
"expression": ["QuestionnaireResponse.item[0].item[2]"],
"diagnostics": "Missing required field: Patient Date of Birth"
}
]
}
}
]
}
Submit a QuestionnaireResponse - $submit
This operation validates and submits a QuestionnaireResponse, marking it as "completed" or "amended". It performs comprehensive validation against the associated Questionnaire definition. If validation fails, it returns only the "issues" parameter without the "response" parameter and does not save the QuestionnaireResponse.
URLs
Copy POST [base]/QuestionnaireResponse/$submit
Parameters
NOTE: All parameters wrapped with Parameters object
Copy resourceType: Parameters
parameter:
- name: response
resource:
# QuestionnaireResponse resource here
The operation takes a single input parameter named "response" containing a QuestionnaireResponse resource wrapped in a Parameters resource.
Output Parameters
The operation returns:
response : The submitted QuestionnaireResponse resource with status updated to "completed"
issues : Any validation issues encountered (if applicable)
Usage Example
Request Success Response Validation Failure Response
Copy POST [base]/QuestionnaireResponse/$submit
content-type: application/fhir+json
{
"resourceType": "Parameters",
"parameter": [
{
"name": "response",
"resource": {
"resourceType": "QuestionnaireResponse",
"questionnaire": "Questionnaire/patient-registration",
"status": "in-progress",
"item": [
{
"linkId": "name",
"text": "Patient Name",
"item": [
{
"linkId": "name.given",
"text": "Given Name",
"answer": [
{
"valueString": "John"
}
]
},
{
"linkId": "name.family",
"text": "Family Name",
"answer": [
{
"valueString": "Smith"
}
]
}
]
},
{
"linkId": "birthDate",
"text": "Date of Birth",
"answer": [
{
"valueDate": "1970-01-01"
}
]
},
{
"linkId": "gender",
"text": "Gender",
"answer": [
{
"valueCoding": {
"system": "http://hl7.org/fhir/administrative-gender",
"code": "male",
"display": "Male"
}
}
]
}
]
}
}
]
}
HTTP status: 200
Copy {
"resourceType": "Parameters",
"parameter": [
{
"name": "response",
"resource": {
"resourceType": "QuestionnaireResponse",
"id": "12c1178c-70a9-4e02-a53d-65b13373926e",
"questionnaire": "Questionnaire/patient-registration",
"status": "completed",
"item": [
{
"linkId": "name",
"text": "Patient Name",
"item": [
{
"linkId": "name.given",
"text": "Given Name",
"answer": [
{
"valueString": "John"
}
]
},
{
"linkId": "name.family",
"text": "Family Name",
"answer": [
{
"valueString": "Smith"
}
]
}
]
},
{
"linkId": "birthDate",
"text": "Date of Birth",
"answer": [
{
"valueDate": "1970-01-01"
}
]
},
{
"linkId": "gender",
"text": "Gender",
"answer": [
{
"valueCoding": {
"system": "http://hl7.org/fhir/administrative-gender",
"code": "male",
"display": "Male"
}
}
]
}
]
}
}
]
}
HTTP status: 200
Copy {
"resourceType": "Parameters",
"parameter": [
{
"name": "issues",
"resource": {
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "required",
"expression": ["QuestionnaireResponse.item[3]"],
"diagnostics": "Missing required field: Contact Information"
}
]
}
}
]
}