Info |
---|
REST API method / Метод REST API (настанова) (remove the link block before publishing the document) |
Table of Contents |
---|
Properties of a REST API method document
...
id | page_properties_method_REST API |
---|
...
Document type
...
Метод REST API
...
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-0001
...
Microservices (namespace)
...
MPI
...
Component
...
Auth
...
Component ID
...
COM-001-001
...
Link на API-специфікацію
...
...
Resource
...
{{host}}//api.ehealth.gov.ua/api/patients/id/encounter_package
...
Scope
...
Protocol type
...
Request type
...
Sync/Async
...
Public/Private
Purpose
Describe the purpose of the API method, add Key points (if necessary)
Logic
Description of the working algorithm of the API method and the interaction of services with each other add Service logic (if necessary)
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
Description of input parameters
...
Input parameter
...
Mandatory
...
Type
...
Description
...
Example
...
composition_id
...
M
...
String ($uuid) (path)
...
Composition object ID
...
89678f60-4cdc-4fe3-ae83-e8b3ebd35c59
...
Request structure
See on API-specification (посилання на сторінку з API-специфікацією)
Description of the REST API request structure, example
...
title | Example |
---|
...
Headers
...
Key
...
Value
...
Mandatory
...
Description
...
Example
...
Content-Type
...
application/json
...
M
...
Тип контенту
...
Content-Type:application/json
...
Authorization
...
Bearer c2778f3064753ea70de870a53795f5c9
...
M
...
Перевірка користувача
...
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
...
Request data validation
Describe the process of checking the input data transmitted in the request for compliance with the given rules and restrictions set in the API
Processing
A list of processes related to receiving, changing or transmitting data according to the logic defined in the REST API
Response structure examples
Description of the REST API response structure, example
...
title | Example |
---|
...
HTTP status codes
...
Response code
...
HTTP Status code
...
Message
...
Internal name
...
Description
...
Базові
...
1000
...
404
...
Composition not found
...
COMPOSITION_NOT_FOUND_404
...
Не знайдено медичний висновок
...
401
...
Unauthorized
...
Помилка підтвердження
...
Специфічні
...
Info |
---|
REST API method / Метод REST API (настанова) (remove the link block before publishing the document) |
Table of Contents |
---|
Properties of a REST API method document
Page Properties | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||
|
Purpose
This web service is designed to change contract request by nhs employee. NHS ADMIN SIGNER should enrich contract request with information about itself, sum and place of the contract request. NHS signer could change only contract request in status = IN_RPOCESS, all other statuses can't be changed
Logic
NHS employee with scopes 'contract_request:update' can change contract request
Contract request only in status 'IN_PROCESS' could be changed
NHS employee can change only several field of the contract request but not all of them
In case of reimbursement contract, nhs_contract_price shouldn`t be filled.
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
Description of input parameters
Input parameter | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 | id |
| String | Contract request identifier. Required | d290f1ee-6c54-4b01-90e6-d701748f0851 |
2 |
Request structure
See on API-specification (посилання на сторінку з API-специфікацією)
Description of the REST API request structure, example
Expand | ||
---|---|---|
| ||
|
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 |
Request data validation
Validate token
Verify the validity of access token
Return 401 in case validation fails
Check if token is not expired
in case error return 401 - "Token is expired"
Validate user
extract client_id from token
Check if user is active
in case error return 403 - (user is not active)
check nhs_legal_entity is active
in case error return 403 - (Client is not active)
Check user role = "NHS ADMIN SIGNER"
in case error return 403 "User is not allowed to perform this action"
Validate scopes
Check user scopes in order to perform this action (scope = 'contract_request:update')
Return 403 in case invalid scope(s) "Your scope does not allow to access this resource. Missing allowances: contract_request:update"
Validate contract request status
Check contract_request.status=IN_PROCESS
in case error return 422 - "Incorrect status of contract_request to modify it"
Validate data
Validate contract request id exists in DB
in case error return 404 ("Contract request with id=$id doesn't exist")
Validate request according to json schema
in case error return 422 ("validation failed")
Validate OPS.contract_request.contract_type == $.contract_type
in case of error return 409 ("Contract_type does not correspond to previously created content")
validate nhs_contract_price
in case contract_type =` REIMBURSEMENT` nhs_contract_price shouldn`t be submitted
in case of error return 409 - "nhs_contract_price is unavailable for reimbursement contract requests`
nhs_contract_price should be >= 0
in case error return 422 ("Contract price could not be negative")
Validate $nhs_signer_id: fetch prm.employees.id=$nhs_signer_id
check client_id=prm.employees.legal_entity_id
in case of error return 422 Error (Employee doesn't belong to legal_entity)
check status='APPROVED' and is_active=true
in case of error return 422 Error (Employee must be active)
Processing
Fill the fields of contract_request in DB with information from request and from employee token:
field | value |
---|---|
contract_requests.nhs_signer_id | $nhs_signer_id |
contract_requests.nhs_legal_entity_id | $client_id |
contract_requests.nhs_signer_base | $.nhs_signer_base |
contract_requests.issue_city | $.issue_city |
contract_requests.nhs_contract_price | $.nhs_contract_price |
contract_requests.nhs_payment_method | $.nhs_payment_method |
contract_requests.updated_by | $.user_id |
contract_requests.updated_at | now() |
Response structure examples
Description of the REST API response structure, example
Expand | ||
---|---|---|
|
field | value |
---|---|
contract_requests.nhs_signer_id | $nhs_signer_id |
contract_requests.nhs_legal_entity_id | $client_id |
contract_requests.nhs_signer_base | $.nhs_signer_base |
contract_requests.issue_city | $.issue_city |
contract_requests.nhs_contract_price | $.nhs_contract_price |
contract_requests.nhs_payment_method | $.nhs_payment_method |
contract_requests.updated_by | $.user_id |
contract_requests.updated_at | now() |
contract_request_update_response.json_schema
Example:
Expand | ||
---|---|---|
| ||
|
HTTP status codes
Response code | HTTP Status code | Message | Internal name | Description | |
---|---|---|---|---|---|
1 | Базові | ||||
2 | 200 | Response |
| ||
3 | 401 |
|
| ||
4 | 401 | Unauthorized | Помилка підтвердження | ||
5 | 403 | User is not allowed to perform this action | |||
6 | 403 |
|
| ||
7 | 403 | Your scope does not allow to access this resource. Missing allowances: contract_request:update | |||
8 | 404 | Contract request with id=$id doesn't exist |
| ||
9 | 1000 | 404 | Composition not found | COMPOSITION_NOT_FOUND_404 | Не знайдено медичний висновок |
10 | 409 |
| Validation failed | ||
11 | 409 | Contract_type does not correspond to previously created content | |||
12 | 409 | nhs_contract_price is unavailable for reimbursement contract requests | |||
13 | 422 |
| Validation failed | ||
14 | 422 | Contract price could not be negative | |||
15 | 422 | Employee doesn't belong to legal_entity | |||
16 | 422 | Employee must be active | |||
17 | 422 | validation failed | |||
18 | 422 | Incorrect status of contract_request to modify it | |||
19 | Специфічні | ||||
20 | 422 | Only for active MPI record can be created medication request! |
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
Page Properties Report | ||||
---|---|---|---|---|
|
...