Basics
Authentication
API for Intake functionalities uses an authentication mechanism similar to OAuth2. Each of your requests to the API must include a bearer token in the "Authorization" header. Currently, the API only supports the "client credential" grant type.
Client Credentials grant type
Use the code below to obtain an access token that lets the client authenticate itself:
curl -X 'POST' \
'https://<INSTANCE_URL>/api/v2/oauth2/token' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic <CREDENTIALS>' \
-d '{
"grant_type": "client_credentials",
"scope": "<INSTANCE_URL>/survey.create <INSTANCE_URL>/evidence_assessment.read"
}'
In the response you will obtain an access token, expiration time, and token type.
Example:
{
"access_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6IjEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2NvZ25pdG8taWRwLmV1LWNlbnRyYWwtMS5hbWF6b25hd3MuY29tL2V1LWNlbnRyYWwtMV9VOG5pN09KWGciLCJleHAiOjE2Njc4MzQ4ODAsInVpZCI6IjV1aWs4MDlpcGl2cm5mMWo0NTNhNzE1djgwIiwiYXVkIjoicGxhdGZvcm0tZXUtY2VudHJhbC0xX1U4bmk3T0pYZyIsInNjb3BlIjoiaHR0cHM6Ly9wYXRpZW50LWludGFrZS1kZW1vLnRlc3QuaW5mZXJtZWRpY2EuY29tL3N1cnZleS5yZWFkIGh0dHBzOi8vcGF0aWVudC1pbnRha2UtZGVtby50ZXN0LmluZmVybWVkaWNhLmNvbS9xdWVzdGlvbi51cGRhdGUgaHR0cHM6Ly9wYXRpZW50LWludGFrZS1kZW1vLnRlc3QuaW5mZXJtZWRpY2EuY29tL2V2aWRlbmNlX2Fzc2Vzc21lbnQucmVhZCBodHRwczovL3BhdGllbnQtaW50YWtlLWRlbW8udGVzdC5pbmZlcm1lZGljYS5jb20vcXVlc3Rpb24ucmVhZCBodHRwczovL3BhdGllbnQtaW50YWtlLWRlbW8udGVzdC5pbmZlcm1lZGljYS5jb20vc3VydmV5LmNyZWF0ZSBodHRwczovL3BhdGllbnQtaW50YWtlLWRlbW8udGVzdC5pbmZlcm1lZGljYS5jb20vc3VydmV5LmRlbGV0ZSBodHRwczovL3BhdGllbnQtaW50YWtlLWRlbW8udGVzdC5pbmZlcm1lZGljYS5jb20vc3VydmV5LnVwZGF0ZSBodHRwczovL3BhdGllbnQtaW50YWtlLWRlbW8udGVzdC5pbmZlcm1lZGljYS5jb20vYXBwb2ludG1lbnQucmVhZCBodHRwczovL3BhdGllbnQtaW50YWtlLWRlbW8udGVzdC5pbmZlcm1lZGljYS5jb20va25vd2xlZGdlLnJlYWQiLCJ1bmFtZSI6bnVsbH0.bCstv7Ex18X-C4lc9qapVNeYrNg0ssSvClbuyj1yszsXwqPWxPYglOgJcmBOzmRhvBltVrUVTFuZrHWvrfluSw",
"token_type":"Bearer",
"expires_in":3600
}
Request parameters in body
grant_type (str, required)
Grant type. Must be client_credentials
.
scope (str, optional)
Can be a combination of any scopes associated with an app client. Each scope should be separated by a space. If not added, all scopes will be granted. The table below shows possible scopes.
Scope | Description |
---|---|
<INSTANCE\_URL>/survey.create | Used to create new surveys |
<INSTANCE\_URL>/evidence\_assessment.read | Used to read information about the proposed conditions and the recommended triage given by a completed survey |
<INSTANCE\_URL>/question.update | Used to give and change answers to the question |
<INSTANCE\_URL>/survey.read | Used to read basic information about the survey |
<INSTANCE\_URL>/survey.update | Used to modify basic survey information |
<INSTANCE\_URL>/knowledge.read | Used to read the knowledge base |
<INSTANCE\_URL>/question.read | Used to read questions |
<INSTANCE\_URL>/survey.delete | Used to delete the survey |
<INSTANCE\_URL>/summary.read | Used to read patient information taken from the survey |
Authorization header
The authorization header string is Basic Base64Encode(client_id:client_secret)
. Client_id
and client_secret values
can be obtained from Infermedica.
Making a request
Once you have an access token, you can use it to make a request by sending it in a request header: Authorization: Bearer {access_token}
.
Pagination
Access to lists of data items support pagination to protect the service against overload.
Response object
self (str, required)
URL to current page
first (str, required)
URL to first page
prev (str, optional)
URL to previous page. If none exists, returns null
next (str, optional)
URL to next page. If none exists, returns null
last (str, required)
URL to last page
items (list, required)
Paginated data
Default request parameters in query
limit (number, optional)
Maximum limit of elements per page. Default value is 10
, maximum value is 50
.
Example:
{
"self": "<INSTANCE_URL>/api/v2/surveys?cursor=0",
"first": "<INSTANCE_URL>/api/v2/surveys?cursor=0",
"prev": null,
"next": "<INSTANCE_URL>/api/v2/surveys?cursor=1",
"last": "<INSTANCE_URL>/api/v2/surveys?cursor=1",
"items": [
{
"visit_date": null,
"expired_date": null,
"specialist": null,
"id": "a5398c3a-8df2-4c4f-89ca-8aeca48e0d57",
"status": "completed",
"last_modified_at": "2022-11-20T12:58:09.958763+00:00"
},
{
"visit_date": null,
"expired_date": null,
"specialist": null,
"id": "d2900734-5c46-4219-8128-34577516526c",
"status": "new",
"last_modified_at": "2022-11-20T12:10:14.981489+00:00"
}
]
}
Languages
To see content in a specific language, you need to send the language code as a custom HTTP header called X-USER-LANGUAGE
.
Example of a request using Polish:
curl -X 'GET' \
'https://<INSTANCE_URL>/api/v2/surveys/1a815f9c-8fe2-4a31-9728-550b92c4b077/questions/current' \
-H 'X-USER-LANGUAGE: pl'
If the language is unspecified, surveys will be presented based on the ACCEPT-LANGUAGE
header. More information: developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language (opens in a new tab)
Supported languages: Polish (code: pl)
, English (code: en)
.