Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Purpose

This method searches and returns request to registration employees by idfor registration employee by id. This method uses scopes and context. 

According to the requirements: 

  • The legal entity (Owner, HR) can see only employee_requests that were made by this legal entity.

  • NHS Admin can see all employee_requests

Specification

Page Properties

Link

 https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/employee-requests/get-employee-request-by-id

Посилання на Apiary або Swagger

Resource

 /api/employee_requests/{{id}}

Посилання на ресурс, наприклад: /api/persons/create

Scope

 employee_request:read

Scope для доступу

Components

 Employees

Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription

Microservices

 il/api

Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC

Protocol type

 REST

Тип протоколу, який використовується запитом, наприклад: SOAP | REST

Request type

 GET

Тип запиту API, наприклад: GET, POST, PATCH…

Sync/Async

 Sync

Метод є синхронним чи асинхронним?

Public/Private/Internal

 Public

Потрібно зазначити тип методу за ступенем доступності

Input parameters

Input parameter

Values

Type

Description

Example

id

 

String

Required

 d290f1ee-6c54-4b01-90e6-d701748f0851

Dictionaries

  • POSITION

  • EMPLOYEE_TYPE

  • GENDER

  • +DOCUMENT_TYPE

  • PHONE_TYPE

  • COUNTRY

  • EDUCATION_DEGREE

  • QUALIFICATION_TYPE

  • SPECIALITY_TYPE

  • SPECIALITY_LEVEL

  • SPEC_QUALIFICATION_TYPE

Request structure

See on Apiary

Authorize

Request to process the request using a token in the headers

Headers

Authorization:Bearer c2778f3064753ea70de870a53795f5c9 (string, optional)

Request data validation

Validate request

  1. Verify the validity of access token

    1. in case error return 401

  2. Check user scopes in order to perform this action

...

  1. (scope = 'employee_request:read')

    1. in case error return 403

Validate id

  1. Verify id - employee_request_id exists

    1. in case error return 404 (not found employee request in DB with this ID)

Validate context

  1. Get legal_entity.id from '$.context'. Filter employee requests by legal_entity.id

    1. in case error return 404

Response structure

See on Apiary

Example:

Expand
titleResponse example
Code Block
{
  "meta": {
    "code": 200,
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "6617aeec-15e2-4d6f-b9bd-53559c358f97#17810"
  },
  "data": {
    "division_id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
    "legal_entity_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "position": "P8",
    "start_date": "2017-03-02T10:45:16.000Z",
    "end_date": "2018-03-02T10:45:16.000Z",
    "status": "NEW",
    "employee_type": "DOCTOR",
    "party": {
      "first_name": "Петро",
      "last_name": "Іванов",
      "second_name": "Миколайович",
      "birth_date": "1991-08-19T00:00:00.000Z",
      "gender": "MALE",
      "no_tax_id": false,
      "tax_id: 3126509816 (string, required) - if no_tax_id=true then passport number, otherwise tax_id": "",
      "email": "email@example.com",
      "documents": [
        {
          "type": "PASSPORT",
          "number": "АА120518",
          "issued_by": "Рокитнянським РВ ГУ МВС Київської області",
          "issued_at": "2017-02-28"
        }
      ],
      "phones": [
        {
          "type": "MOBILE",
          "number": "+380503410870"
        }
      ],
      "working_experience": 10,
      "about_myself": "Закінчив всі можливі курси"
    },
    "doctor": {
      "educations": [
        {
          "country": "UA",
          "city": "Київ",
          "institution_name": "Академія Богомольця",
          "issued_date": "2017-02-28",
          "diploma_number": "DD123543",
          "degree": "MASTER",
          "speciality": "Педіатр"
        }
      ],
      "qualifications": [
        {
          "type": "SPECIALIZATION",
          "institution_name": "Академія Богомольця",
          "speciality": "Педіатр",
          "issued_date": "2017",
          "certificate_number": "2017",
          "valid_to": "2017",
          "additional_info": "додаткова інофрмація"
        }
      ],
      "specialities": [
        {
          "speciality": "THERAPIST",
          "speciality_officio": true,
          "level": "FIRST",
          "qualification_type": "AWARDING",
          "attestation_name": "Академія Богомольця",
          "attestation_date": "2017-02-28",
          "valid_to_date": "2020-02-28",
          "certificate_number": "AB/21331"
        }
      ],
      "science_degree": {
        "country": "UA",
        "city": "Київ",
        "degree": "",
        "institution_name": "Академія Богомольця",
        "diploma_number": "DD123543",
        "speciality": "Педіатр",
        "issued_date": "2017"
      }
    },
    "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
    "inserted_at": "2017-05-05T14:09:59.232112",
    "updated_at": "2017-05-05T14:09:59.232112"
  },
  "urgent": {
    "user_id": "d290f1ee-6c54-4b01-90e6-d701748f0851"
  }
}

HTTP status codes

HTTP status code

Message

What caused the error

200

Response

 

401

Error

 Access token validation failed

403

Error

Check user scopes in order to perform this action failed

404

  1. Not found employee request in DB with this ID

  2. Error

2. Get legal_entity.id from '$.context'. Filter employee requests by legal_entity.id failed