AlayaCare External API Guide
Documentation around AlayaCare’s external REST APIs.
Note that API specifications are documented in SwaggerHub. Links to each API interface are provided below.
Contents
Available APIs
Care Plan
Care Plan creation, care plan details and statuses, tags, diagnosis, goals, forms and interventions
Base URL Path
https://example.alayacare.ca/ext/api/v2/clinical/
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/api-care-plan-external
Clients
Client (patient) demographics and status, client contacts, link to client’s AlayaCare profile and picture, and groups
Base URL path
https://example.alayacare.ca/ext/api/v2/patients/
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/client-api-external
Employees
Employee demographics and status, employee contacts, link to employee’s AlayaCare profile and picture, designations, groups, and departments
Base URL path
https://example.alayacare.ca/ext/api/v2/employees/employees/
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/employee-api-external
Employees Skills
Skill categories, skills details and employee skills association details
Base URL path
https://example.alayacare.ca/ext/api/v2/employees/
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/employee-skills-external-api
Employees Unavailabilities
Unavailability details and time off type details
Base URL path
https://example.alayacare.ca/ext/api/v2/employees/
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/employee-unavailability-api-external
Scheduler
Visit details, activities of daily living, facilities, facility visits
Base URL path
https://example.alayacare.ca/ext/api/v2/scheduler/
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/scheduler-api-external
Services
Service details and creation, service codes, service tags and service forms
Base URL Path
https://example.alayacare.ca/ext/api/v2/scheduler/
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/services-api-external
Tasks
Task details and creation
Base URL path
https://example.alayacare.ca/ext/api/v2/tasks/
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/tasks-api-external
Tasks v2
Taskv2 details, creation. Subtasks and comments management
Base URL path
https://example.alayacare.ca/api/v2/tasks
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/tasks-v2-api-external
Files
Client attachments and directories
Base URL path
https://example.alayacare.ca/ext/api/v2/files/
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/files-api-external
Clinical
Client progress notes (read-only), Medications, Medication Administrations, Vitals
Base URL path
https://example.alayacare.ca/ext/api/v2/clinical/
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/clinical-api-external
Forms
Form Submissions, visits information with form submissions
Base URL path
https://example.alayacare.ca/ext/api/v2/tasks/forms20
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/clinical-api-external
Accounting
Visit premiums
Base URL path
https://example.alayacare.ca/ext/api/v2/accounting/
Swagger specification
https://app.swaggerhub.com/apis/AlayaCare/accounting-api-external
Intake
AlayaCare Referrals for client intake and service creation
Base URL path
n/a
Documentation
Medication
Medications, Medication Settings (read-only)
Base URL path
https://example.alayacare.ca/ext/api/v3/clinical/
Swagger specification
https://app.swaggerhub.com/apis-docs/AlayaCare/api-medication-external/1.0
Overview
AlayaCare offers a suite of RESTful APIs to manage integration and data needs for our clients. We leverage Amazon Web Services SQS queues to stream events from AlayaCare for clients’ middleware to consume and act upon for two-way integrations and we support one-way integrations through the REST interface.
Architecture
Overview of the technical architecture with examples of other external systems at play:
Technical Architecture
Please see the following document for an in-depth description of the technical architecture:
AlayaCare External API Technical Architecture
SQS Message Format
Please see the following document for sample SQS message body formats:
Authentication
AlayaCare REST APIs use Basic Authentication.
AlayaCare will provide your team with the public key and private key required for authentication via LastPass. These keys are tied to the database, so if you are using UAT or Staging for access, keep in mind these environments might be restored in accordance with AlayaCare’s operations and new keys will have to be generated.
AlayaCare will also provide credentials for accessing the AWS SQS queues should your integration plan require that feature.
Access
Using the base URL route provided above, replace example
with your tenant name and environment, if applicable (e.g.
Using the Swagger documentation provided, you can complete a given path to call the API.
REST Client Configuration
If you are using a REST client (e.g. Postman), ensure the following parameters are configured:
Authentication
- Basic authentication
- Username = AlayaCare public key
- Password = AlayaCare private key
Encoding
- Raw JSON (application/json)
Sample API Calls
Return a single patient
To return a single patient from the system, use the following URL: https://example.alayacare.ca/ext/api/v2/patients/clients/1002
{
"demographics": {
"address": "896 Eglinton Ave E",
"birthday": "1983-10-07",
"city": "Toronto",
"company": "",
"country": "CA",
"email": "ge_ryan@freespace.com",
"email_preferred": "0",
"first_name": "Gemma",
"full_address": "888 Eglinton Ave E Toronto ON M4G 2L2 CA",
"full_name": "Gemma Ryan",
"gcm_registration_id": "APA91bHZ9VC6qPnJbY ",
"gender": "F",
"job_title": "Therapist, OT, PT",
"last_name": "Ryan",
"phone_main": "(647) 477-7777, #102",
"phone_personal": "4164445544",
"state": "ON",
"title": "Ms",
"uid": "1002; 1-2073563726",
"zip": "M4G 2L2"
},
"external_id": "2073563726",
"id": 1002,
"status": "active"
}
Note that the ID used for this call was an AlayaCare ID. To query a patient by their external ID (e.g. their CRM ID was imported into AlayaCare), use the following URL: https://example.alayacare.ca/ext/api/v2/patients/clients/by_id/260449
Return a list of employees using query parameters
To return the list of all employees in the system, use the following URL: https://example.alayacare.ca/ext/api/v2/employees/employees
However, you can use the parameters outlined in Swagger to narrow down this query. For example:
https://example.alayacare.ca/ext/api/v2/employees/employees?page=1&count=10&filter=john
returns a single page, with maximum 10 employees, who have a value containing John
on their profile.
The filter
query matches on values in the demographics
entity of a profile. In the AlayaCare web interface, demographics fields on both client and employee profiles are configurable through System Settings > Form Context.
Result snippet:
{
"count": 7,
"items": [
{
"_link": "https://demo3.staging.alayacare.ca/#/employee/default/view/id/3w",
"departments": [],
"external_id": "1234",
"first_name": "Johny",
"id": 140,
"job_title": null,
"last_name": "Validation",
"status": "1"
},
{
"_link": "https://demo3.staging.alayacare.ca/#/employee/default/view/id/4b",
"departments": [],
"external_id": null,
"first_name": "John",
"id": 155,
"job_title": null,
"last_name": "Snow",
"status": "2"
},
...]
}
Return a list of visits filtered by date
To return a list of visits within a certain range, use YYYY-MM-DD HH:mm
format in the queries. By default, the time is in UTC, so to search for visits within EST, put -05:00
and the end of the query. Spaces in the query between the date and time elements are converted to %20
.
For example, to get a list of visits on January 5th, 2018, between 1 p.m. and 3 p.m. EST, use the following URL:
Result snippet:
{
"count": 3,
"items": [
{
"alayacare_client_id": 1002,
"alayacare_employee_id": 109,
"alayacare_service_id": 2,
"alayacare_visit_id": 526,
"cancelled": false,
"client_id": null,
"employee_id": null,
"end_at": "2018-01-05T21:05:00+00:00",
"service_id": "",
"start_at": "2018-01-05T20:05:00+00:00",
"visit_id": null
},
{
"alayacare_client_id": 1004,
"alayacare_employee_id": 109,
"alayacare_service_id": 5,
"alayacare_visit_id": 422,
"cancelled": false,
"client_id": null,
"employee_id": null,
"end_at": "2018-01-05T22:26:34+00:00",
"service_id": "",
"start_at": "2018-01-05T21:26:34+00:00",
"visit_id": null
},
{
"alayacare_client_id": 1009,
"alayacare_employee_id": 113,
"alayacare_service_id": 12,
"alayacare_visit_id": 512,
"cancelled": false,
"client_id": null,
"employee_id": null,
"end_at": "2018-01-05T22:55:00+00:00",
"service_id": "",
"start_at": "2018-01-05T21:55:00+00:00",
"visit_id": null
}
],
"items_per_page": 100,
"page": 1,
"total_pages": 1
}