Fetching Task Results
In this guide, you’ll learn how to use the Opkit API to fetch results from completed tasks.
Step by Step
Make a GET request to https://api.opkit.co/v1/tasks/[task-id]
.
curl -X GET https://api.opkit.co/v1/tasks/[task-id] \ -H "Authorization: Bearer [api_key]"
Be sure to replace [api_key]
and [task-id]
with their respective values.
The GET request will return a response that includes all the information about the task, including results corresponding to the objectives that you specified when creating the task.
{
"id": "22818c08-c6d0-44cb-85c0-12fe9d220d4b",
"created_at": "2023-10-31T23:39:25Z",
"template_id": [template-id],
"target_id": [target-id],
"context": [
{
"name": "patient name",
"value": "John Smith"
},
{
"name": "Patient Date of Birth",
"value": "1992-10-10"
}
],
"objectives": [
{
"name": "insurance_valid",
"description": "Check if insurance is valid",
"type": "boolean",
"result": "true"
}
],
"status": "success" // The status could also be 'pending', 'in_progress', 'failure'
}