Patient Add Form to Case
Submits a dynamic customer case form for a specific case and customer.
HTTP Request
POST <BASE_URL>/api/v1/customer-dynamic-case-form
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| cv-api-key | string | Yes | Secret API key for authentication |
Request Body (JSON)
| Name | Type | Required | Description |
|---|---|---|---|
| key | string | No | API key (if not provided in header) |
| caseId | string | Yes | The ID of the case to update |
| formTitle | string | Yes | Title of the form |
| formDescription | string | No | Description of the form |
| questions | array | Yes | Array of question objects (see below) |
Question Object
| Name | Type | Required | Description |
|---|---|---|---|
| questionId | string | Yes | The ID of the question |
| question | string | Yes | The question text |
| type | string | Yes | The type of the question (e.g., text, file, multiselect) |
| required | boolean | No | Whether the question is required |
| answer | any | Yes | The answer to the question |
| phi | boolean | No | Whether the question contains PHI |
| hint | string | No | Hint text for the question |
| placeholder | string | No | Placeholder text for the question |
| options | array | No | Options for select/multiselect questions |
Responses
200 OK
{
"status": 200,
"success": true,
"data": {
"caseId": "string",
"formResponseId": "string"
}
}
Error Responses
- If any required parameter (
key,caseId,formTitle, orquestions) is missing:
{
"status": 400,
"success": false,
"error": "The '<param>' param is required"
}
- If a required field in a question is missing:
{
"status": 400,
"success": false,
"error": "The 'questions[<index>].<field>' field is required"
}
- If the secret key is not provided:
{
"status": 400,
"success": false,
"error": "Secret key not provided!"
}
- If the partner organization is disabled:
{
"status": 400,
"success": false,
"error": "Partner organization is disabled"
}
- If the provided case is not valid for the organization:
{
"status": 400,
"success": false,
"error": "Provided case is not valid"
}
- If the form cannot be submitted (no question responses):
{
"status": 400,
"success": false,
"error": "Case Form can't be Submitted."
}
Example Request
curl -X POST "<BASE_URL>/api/v1/customer-dynamic-case-form" \
-H "cv-api-key: your-secret-key" \
-H "Content-Type: application/json" \
-d '{
"caseId": "abc123",
"formTitle": "Health Survey",
"formDescription": "Initial intake",
"questions": [
{ "questionId": "q1", "answer": "Yes" },
{ "questionId": "q2", "answer": 42 }
]
}'
Notes
- The
cv-api-keycan be provided either as a header or in thekeyfield of the request body. - The
questionsarray must contain at least one question object. - The response includes the
caseIdand the generatedformResponseIdfor the submission.