Purpose
API paragraph not found
Specification
Logic
Only authenticated and authorized HR, ADMIN, OWNER employees from MSP, OUTPATIENT, PRIMARY_CARE, EMERGENCY legal entities can get the equipment by id.
Service returns only equipment related to the same legal entity as the user. User with role NHS ADMIN can get any equipment from any legal entity.
Request structure
API paragraph not found
Authorize
Verify the validity of access token
Return 401 in case validation fails
Check scopes in order to perform this action (scope = 'equipment:read')
Return 403 in case invalid scope(s)
Headers
Наприклад:
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
api-key:uXhEczJ56adsfh3Ri9SUkc4en
Request data validation
Validate equipment
Check that equipment with such ID exists in the system (is_active = true)
In case of error - return 404
Check that equipment with such ID belongs to to the same legal entity as the user OR user has NHS ADMIN role.
In case of error - return 403
Processing
API paragraph not found
Response structure
See on Apiary
Example:
HTTP status codes
Prepare response
Render response if is_active = true, else - return error with code 404