Properties of a REST API method document
Document type | Метод REST API |
---|---|
Document title | Get Medication dispense details in person context [API-005-008-001-0129] |
Guideline ID | GUI-0011 |
Author | @ |
Document version | 1 |
Document status | DRAFT |
Date of creation | ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD) |
Date of update | ХХ.ХХ.ХХХХ (дата зміни версії) |
Method API ID | API-005-008-001-0129 |
Microservices (namespace) | IL |
Component | ePrescription |
Component ID | COM-005-008 |
Link на API-специфікацію | |
Resource | {{host}}/api/persons/person_id/medication_dispenses/id |
Scope | medication_dispense:read |
Protocol type | REST |
Request type | GET |
Sync/Async | Sync |
Public/Private | Public |
Purpose
This method allows getting short information about the patient’s Medication dispense. Obtaining a medication dispenses list or receiving full information is restricted for the MSP side. Only short medication dispense information is allowed.
Logic
Service returns specified Medication dispense related to the patient:
Get Medication dispense by ID from medication_dispenses DB (OPS).
Validate data consistency:
Ensure that requested Medication dispense relates to requested Patient (from URL)
Return 404 ('not_found') in case of error.
Render a response according to specification.
Preconditions
N/A
Configuration parameters
Access to the method is defined by the scope medication_dispense:read. Permission for this scope is determined by the System administrator by configuring scopes in the context of clients and roles.
Dictionaries
API paragraph not found
Input parameters
Input parameter | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 | id | M | String | Medication Dispense Response Identifier. Required. | a89f6a26-4221-4597-a1d2-542d5e40b565 |
Request structure
See on API-specification
Headers
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 = 'medication_dispense:read')
Return (403, 'Your scope does not allow to access this resource. Missing allowances: medication dispense:read') in case of invalid scope(s).
Validate Person
Get Person identifier from the URL.
Check it exists in DB
Return 404 ('not_found') in case of error.
Validate Medication dispense
Get Medication dispense identifier from the URL
Check it exists in DB
Return 404 ('not_found') in case of error;
Check Medication dispense belongs to patient
Return 404 ('not_found') in case of error.
Validate User
Extract user_id from token.
Check user has an active and approved employee from legal entity (token) that:
has an active declaration with the patient;
has access to connected with medication requests episode with the patient (created in current MSP or approval on Episode resource);
has access to connected with medication requests care plan with the patient (approval on Care plan resource)
Return 403 ('Access denied') in case employee has no declaration or access connected with medication requests episode or care plan.
Response structure examples
See on API-specification
Expand | ||
---|---|---|
| ||
|
HTTP status codes
Response code | HTTP Status code | Message | Internal name | Description | |
---|---|---|---|---|---|
1 | Базові | ||||
2 |
| 401 | Invalid access token | Недійсний токен доступу | |
3 | 403 | Your scope does not allow to access this resource. Missing allowances: medication dispense:read | Для вашої ролі відсутній доступ до цього ресурсу. Необхідний доступ на отримання інформації про відпущені рецепти | ||
4 | 403 | Access denied | У доступі відмовлено | ||
5 | 404 | not_found | не знайдено | ||
6 | Специфічні | ||||
7 |
|
Post-processing processes
N/A
Technical modules where the method is used
Title |
---|
No content found |