ЕСОЗ - публічна документація
[DRAFT] REST API Get approvals [API-001-001-001-0004]
Сторінка знаходиться в процесі розробки. Інформація на ній може бути застарілою.
https://e-health-ua.atlassian.net/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)
- 1 Properties of a REST API method document
- 2 Purpose
- 3 Logic
- 3.1 Filters
- 3.2 Service Logic
- 4 Configuration parameters
- 5 Dictionaries
- 6 Input parameters
- 7 Request structure
- 8 Headers
- 9 Request data validation
- 9.1 Authorize
- 9.2 Validate Patient
- 9.3 Validate Approval
- 9.4 Validate User
- 10 Processing
- 11 Response structure examples
- 12 HTTP status codes
- 13 Post-processing processes
- 14 Technical modules where the method is used
Properties of a REST API method document
Document type | Метод REST API |
---|---|
Document title | [Document status] REST API [Назва методу] [ID методу] |
Guideline ID | GUI-0011 |
Author | @ |
Document version | 1 |
Document status | DRAFT |
Date of creation | ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD) |
Date of update | ХХ.ХХ.ХХХХ (дата зміни версії) |
Method API ID | API-001-001-001-0004 |
Microservices (namespace) | ABAC |
Component | Approvals/ABAC |
Component ID | COM-001-001 |
Link на API-специфікацію | https://medicaleventsmisapi.docs.apiary.io/#reference/approvals/get-approvals/get-approvals |
Resource | {{host}}/api/patients/{{patient_id}}/approvals |
Scope | approval:read |
Protocol type | REST |
Request type | GET |
Sync/Async | Sync |
Public/Private | Public |
Purpose
This WS intended to get a list of patient approvals filtered by search params.
Logic
Method for receiving a list of patient approvals. It is allowed only for the doctor who has an active declaration with a patient from url (can get all approvals) or approval is granted to user (can get own approval).
Filters
Filter | Values | Type | Description | Example |
---|---|---|---|---|
patient_id |
| String | identifier of the patient |
|
granted_to |
| String | identifier of the employee or legal entity to whom access has been granted |
|
granted_resources |
| String | identifier of the entity for which the approval was created |
|
granted_resource_type |
| String | entity type for which the approval was created |
|
status |
| String | status of approval |
|
reason |
| String | type and identifier of entity based on which approval has been created |
|
access_level |
| String | access level to data |
|
page |
| Number | Page number |
|
page_size |
| Number | A limit on the number of objects to be returned, between 1 and 100. Default: 50 |
|
Service Logic
Service returns all approvals related to the patient filtered by submitted parameters:
Get all approvals by patient_id from approvals collection (MongoDB)
Filter list above by submitted search parameters
Render a response according to specification.
Configuration parameters
Description of the configuration parameters that are used when processing a request in the system
Dictionaries
Provides a list of links to dictionaries that are available in Confluence
Input parameters
Input parameter | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 |
|
|
|
|
|
2 |
|
|
|
|
|
Request structure
See on API-specification
Headers
Key | Value | Mandatory | Description | Example | |
---|---|---|---|---|---|
1 | Content-Type | application/json | M | Тип контенту | Content-Type:application/json |
2 | Authorization | Bearer c2778f3064753ea70de870a53795f5c9 | M | Перевірка користувача | Authorization:Bearer c2778f3064753ea70de870a53795f5c9 |
3 | api-key | uXhEczJ56adsfh3Ri9SUkc4en |
| Секретний ключ | api-key:uXhEczJ56adsfh3Ri9SUkc4en |
Request data validation
Authorize
Verify the validity of access token
Return (401, 'Invalid access token') in case of validation fails
Verify that token is not expired
in case of error - return (401, 'Invalid access token')
Check user scopes in order to perform this action (scope = 'approval:read')
Return (403, 'Your scope does not allow to access this resource. Missing allowances: approval:read') in case of invalid scope(s)
Request to process the request using a token in the headers
Validate Patient
Get Patient identifier from the URL
Check it exists in DB
Return 404 ('Person is not found') in case of error
Validate Approval
Get Approval identifier from the URL
Check it exists in DB
Return 404 ('not found') in case of error
Validate User
Extract user_id from token.
Check user has an active declaration with a patient from URL (can get all approvals) or approval is granted to user (can get own approval: granted_to OR created_by):
Return 200 with empty array in case the employee doesn't have an active declaration with the patient or approval is granted to user
Processing
Response structure examples
See on Apiary
Example:
HTTP status codes
Response code | HTTP Status code | Message | Internal name | Description | |
---|---|---|---|---|---|
1 | Базові | ||||
2 |
| 200 |
|
|
|
3 |
| 401 | Invalid access token |
|
|
4 |
| 403 | Your scope does not allow to access this resource. Missing allowances: approval:read |
|
|
5 |
| 404 | not found |
|
|
6 |
| 404 | Person is not found |
|
|
7 | Специфічні | ||||
8 |
|
|
|
|
|
Post-processing processes
Description of actions performed on data after processing
Technical modules where the method is used
List of pages describing technical modules where the method is used
ЕСОЗ - публічна документація