Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
REST API method / Метод REST API (настанова) (
Info
Info

/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)

...

Page Properties
idpage_properties_method_REST API

Document type

Метод REST API

Document title

[Document status] REST API [Назва методу] [ID методуDRAFT] Update license [API-005-009-003-0189]

Guideline ID

GUI-0011

Author

@Viacheslav Tybin (SoE eHealth)

Document version

1

Document status

DRAFT

Date of creation

ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD)

Date of update

ХХ.ХХ.ХХХХ (дата зміни версії)

Method API ID

API-005-009-003-0189

Microservices (namespace)

IL

Component

Legal Entities

Component ID

COM-005-009

Link на API-специфікацію

https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/licenses/update-license

Resource

{{host}}/api/licenses/{{id}}

Scope

license:write

Protocol type

REST

Request type

PATCH

Sync/Async

Sync

Public/Private

Public

...

Input parameter

Mandatory

Type

Description

Example

1

id

 

String

Required

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

2

Request structure

See on ApiarySee on API-specification

Expand
titleExample
Code Block
languagejson
{
  "type": "MSP",
  "license_number": "fd123443",
  "issued_by": "Кваліфікацйна комісія",
  "issued_date": "2022-02-28",
  "expiry_date": "2026-02-28",
  "active_from_date": "2022-02-28",
  "what_licensed": "реалізація наркотичних засобів",
  "order_no": "ВА43234",
  "is_primary": false
}Headers

...

  • Check that updated license exists in database

    • in case of error - return 404 (“License was not found”)

  • Check that updated license has is_primary=false flag

    • in case of error - return 409 (“Only additional license can be updated”)

  • Check that additional license flag was passed in request ($.is_primary = false)

    • in case of error - return 422 (“Additional license can not be changed to primary”)

  • Check that updated license belongs to legal entity from access token

    • in case of error - return 409 (“License doesn't correspond to your legal entity")

  • Check that license type in request equals updated license type

    • in case of error - return 409 (“License type can not be updated”)

  • Check that legal entity has active primary license (request: select id from licenses where is_active=true and is_primary=true and legal_entity_id=$.legal_entity.id and (expiry_date >= current_date() or expiry_date is null); returns at least one value returns at least one value)

    • in case of error - return 404 (“No active primary license found for legal entity”)

...

Expand
titleExample
Code Block
languagejson
{
  "meta": {
    "code": 200,
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "data": {
    "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "type": "MSP",
    "license_number": "fd123443",
    "issued_by": "Кваліфікацйна комісія",
    "issued_date": "2022-02-28",
    "expiry_date": "2026-02-28",
    "active_from_date": "2022-02-28",
    "what_licensed": "реалізація наркотичних засобів",
    "order_no": "ВА43234",
    "legal_entity_id": "28d9c1be-08f0-403b-aa76-bff228c9904f",
    "is_primary": true
  }
}HTTP status codes

...