ЕСОЗ - публічна документація
Update Substance
Status
- Specification DONE
- Apiary DONE
- JSON schema request DONE
- JSON schema response SPECS
Purpose
This WS is designed to update substance (post).
APIary
Input parameters
- id
- name
- name_original
- sctid
is_active
Authorize
- Verify the validity of access token
- Check user scope (scope = 'substance:write') in order to perform this action
- In case error - generate 401 response
Validate request (JSON schema)
Validate request using JSON schema (link !!! TBD)
Check existing substance
- Check exist substance by if $.id in payload
- if found - return 409 error (message: "Substance does not exist!")
Validate statuses linked medication
Purpose validation: Status innm must be equal to statuses linked medication.
- Get `is_active` medications (linked with substance) in the opposite $.is_active in payload
IF EXISTS( SELECT * FROM medications M WHERE M.type == INNM AND M.ingridients.id = $.id AND M.is_active != $.is_active )
- if found - return 409 error (message: "Status innm must be equal to statuses linked medications!")
Update substance data
- Update substance data according to payload parameters.
Return data structure:
- id
- name
- name_original
- innm_identifier
is_active
tech info (created, updated)
ЕСОЗ - публічна документація