ЕСОЗ - публічна документація

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 

update-substance

Input parameters 

  • id 
  • name
  • name_original
  • sctid
  • is_active

Authorize

  1. Verify the validity of access token
  2. Check user scope (scope = 'substance:write') in order to perform this action
    1. In case error - generate 401 response

Validate request (JSON schema)

Validate request using JSON schema (link !!! TBD)

Check existing substance

  1. Check exist substance by if $.id in payload
    1. 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.

  1. Get `is_active` medications (linked with substance) in the opposite $.is_active in payload
    1. IF EXISTS(
      	SELECT * FROM medications M
      	WHERE M.type == INNM
      		AND M.ingridients.id = $.id
      		AND M.is_active != $.is_active
      )	
    2. if found -  return 409 error (message: "Status innm must be equal to statuses linked medications!")

Update substance data

  1. Update substance data according to payload parameters.

Return data structure:

  • id 
  • name
  • name_original
  • innm_identifier
  • is_active

  • tech info (created, updated)

ЕСОЗ - публічна документація