forked from DScheglov/ehealth.api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapiary.apib
2585 lines (1941 loc) · 95.9 KB
/
apiary.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
FORMAT: 1A
HOST: http://ehealth.nebo15.com/
# eHealth API
This is a API documentation for Ukrainian Health Services government institution back-end, that should provide:
* Master Patients Index (MPI)
* Global Medical Institutions and Doctors Registries
* Partnership Relation Management (PRM) module that describes business relations between this 3 entities.
Project development is fully transparent, you can find it's source code on GitHub:
* [eHealth API and issue tracker](https://github.com/Nebo15/ehealth.api)
* [Master Patient Index](https://github.com/Nebo15/mpi.api)
* [Partnership Relation Management](https://github.com/Nebo15/prm.api)
<!-- * [Reference Implementation of Hospital Information System UI](https://github.com/Nebo15/prm.web) -->
This API design in based on [Nebo #15 API Design Manifest](http://docs.apimanifest.apiary.io/).
## Docs Structure
This document contains both internal and public (usually `/api/..`) API specifications. If you plan to use it as outside API consumer - please refer only to sections that marked as `Public`.
<!--
## Patination
We apply cursor based pagination..
## Autentification
We use three-legged oAuth authentication, RFC..
-->
## Context Switching for end-users
Since Doctor may have multiple work-places, you MUST fetch list of possible work-contexts and apply `legal_entity_id` filter on each request, where this parameter is available.
Thus you will make sure that end-user understand from which context entities are managed.
If our API returns only one work context, you are free to hide context picker.
## Contribution Guidelines
TODO.
## Submitting Issues
To submit issues you should use [Issue Tracking Repo](https://github.com/Nebo15/ehealth.api), issues in all other repositories are used to plan backlog and non-related issued will be closed.
# Group Internal. Authorization Provider
For security purposes eHealth doesn't allow proxying passwords or to perform any sort back-end authorization. You should always redirect your customers (eg. doctors, we call them "consumers") to the Login UI.
After obtaining `access_token` all subsequent requests should be made with `Authorization: Bearer base64(access_token:)` header.
## Login UI [/oauth]
### Show Login UI [GET /oauth/ui{?client_id,redirect_url,scope,response_type}]
This method renders response login page. It's structure can differ by required scopes and security measures enabled by project (they can change).
For security purposes, we will set `X-Frame-Options: deny` header that will disallow opening this page in an iframe.
+ Parameters
+ client_id: `mis-001` (string, required) - Medical Information System ID issued upon integration request. Used to identify application developer.
+ redirect_url: http://example.com/ (string, required) - URL where user will be redirected after authentification. This url will receive `code` and `state` parameters in query string.
+ scope: `capitation_contracts:view capitation_contracts:create patients:view patients:create` (string, required) - List of scopes that is required in application business logic, separated by space. Different login forms will be shown based on scopes that you requested.
+ response_type: code (enum, required) - Response type, only `code` is supported.
+ Response 200 (text/html; charset=UTF-8)
+ Headers
X-CSRF-Token: my-csrf-token
## oAuth Codes [/oauth/codes]
### Issues oAuth Code Grant [POST /oauth/codes]
API consumer **back-end** should use this method exchange Code Grant to Access Token.
+ Request (application/json)
+ Headers
X-CSRF-Token: `my-csrf-token`
+ Attributes (object)
+ client_id: `mis-001` (string, required) - Medical Information System ID issued upon integration request. Used to identify application developer.
+ login: gandalf (string, required) - Consumer login.
+ password: secret (string, required) - Consumer password.
+ timestamp: 1489583714 (number, optional) - Timestamp when request was made. If timestamp was made more than 15 minutes ago, corresponding error will be returned. Required only if `signature` is present.
+ signature: signature (string, optional) - `login + bcrypt(password) + timestamp` string signed with a consumer's private key. Required for some scopes.
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (object)
+ code: 299383828 (string, required) - oAuth code grant
## oAuth Tokens [/oauth/tokens]
### Exchange oAuth Code Grant to Access Token [POST]
+ Request (application/json)
+ Headers
X-CSRF-Token: my-csrf-token
+ Attributes (object)
+ client_id: `mis-001` (string, required) - Medical Information System ID issued upon integration request. Used to identify application developer.
+ client_secret: `mis-001-secret-key` (string, required) - Medical Information System secret key issued upon integration request. Used to identify application developer.
+ code: 299383828 (string, required) - oAuth code grant.
+ `grant_type`: authorization_code (string, fixed) - oAuth Grant Type. Currently only `authorization_code` is supported.
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (Access_Token)
+ msp_id: null (string, optional)
### Get oAuth Access Token details [GET /oauth/tokens/{access_token}]
This method is designed to be used only by eHealth API gateway.
+ Parameters
+ access_token: `my-oauth-token` (string, required) - oAuth access token.
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Access_Token)
### Set an oAuth Access Token MSP Context [PATCH /oauth/tokens/{access_token}]
This method is designed to be used only by eHealth API gateway.
+ Parameters
+ access_token: `my-oauth-token` (string, required) - oAuth access token.
+ Request (application/json)
+ Attributes
+ msp_id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, optional)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Access_Token)
+ msp_id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
# Group Internal. Master Patients Index
## Persons [/persons]
To make sure that records will be de-duplicated, please make sure to send search request before creating a new record.
### Check that Patient exists by ID [HEAD /persons/{id}]
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ
+ Response 200 (application/json)
### Get Patient by ID [GET /persons/{id}]
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`Person_Full`)
### Create Patient [POST]
+ Request (application/json)
+ Headers
Authorization: Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ
+ Attributes (Person)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`Person_Full`)
### Update Patient [PATCH /persons/{id}]
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ
+ Attributes (Person)
+ is_active: true (boolean, required)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`Person_Full`)
### Search for a Person [GET /api/persons{?first_name,last_name,second_name,birth_date,tax_id,phone_number,birth_place,starting_after,ending_before,limit}]
This method allows to search for a Person (MPI) without disclosing personal data.
Method returns only **requested** parameters, birth place and second name in addition for manual identification on MSP side.
+ Parameters
+ first_name: Петро (string, required)
+ last_name: Іванов (string, required)
+ second_name: Миколайович (string, optional)
+ birth_date: `1991-08-19T00:00:00.000Z` (string, required) - ISO Datetime.
+ tax_id: 3126509816 (string, optional)
+ phone_number: `+380508887700` (string, optional)
+ limit: 20 (number, optional) - A limit on the number of objects to be returned, between 1 and 100. Default: 50.
+ starting_after: 56c31536a60ad644060041af (string, optional) - A cursor to fetch next page. Taken from collection response.
+ ending_before: 56c31536a60ad644060041aa (string, optional) - A cursor to fetch previous page. Taken from collection response.
+ Request (application/json)
+ Headers
Authorization: Bearer mF_9.B5f-4.1JqM
+ Response 200 (application/json)
+ Attributes (Response_Collection)
+ data (array[`Person_Short`])
+ Response 403 (application/json)
+ Attributes (Response_Error)
+ meta (Response__Meta, fixed-type)
+ code: 403 (number)
+ error (Response__Error, fixed-type)
+ type: `too_many_results`
+ message: `This API method returns only exact match results, please retry with more specific search result` (string)
## Confident Persons [/persons/{id}/confident_persons]
### Add Confidant Person [POST /persons/{id}/confident_persons]
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required) - Person ID
+ Request (application/json)
+ Headers
Authorization: Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ
+ Attributes (object)
+ person_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - Confident Person ID
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (Person_Full)
### Remove Confident Person [DELETE /persons/{id}/confident_persons/{confident_person_id}]
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required) - Person ID
+ confident_person_id: `d290f1ee-6c54-4b01-90e6-d701748f0852` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Person_Full)
# Group Internal. Partner Relationship Management
## Declarations [/declarations]
### Create Declaration [POST]
Method to register new declaration record
+ Request (application/json)
+ Attributes (Declaration)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`crud_Declaration_get`)
### Update declaration [PATCH /declaration/{id}]
This method to update the declaration status.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes (crud_Declaration_patch)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_Declaration_get`)
### Get Declaration Details by ID [GET /declarations/{id}]
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_Declaration_get`)
### Get Declarations List [GET /declarations{?person_id,employee_id,legal_entity_id,division_id,status,starting_after,ending_before,limit}]
Methods returns list of declarations by combination of patient_id, doctor_id, msp_id.
Response will contain only records that you have access to.
+ Parameters
+ person_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MPI ID of a patient.
+ employee_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MPI ID of a doctor.
+ `legal_entity_id`: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MSP ID.
+ division_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MSP ID.
+ status: active (text, optional) - Search only for active or disabled declarations.
+ limit: 20 (number) - A limit on the number of objects to be returned, between 1 and 100. Default: 50.
+ starting_after: 56c31536a60ad644060041af (string, optional) - A cursor to fetch next page. Taken from collection response.
+ ending_before: 56c31536a60ad644060041aa (string, optional) - A cursor to fetch previous page. Taken from collection response.
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_Collection)
+ data (array[`crud_Declaration_get`])
## Party [/party]
### Create new party [POST]
Method to create new party record.
+ Request (application/json)
+ Attributes (`crud_party_post`)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`crud_party_get`)
### Update party [PATCH /party/{id}]
This method to update the employee info by ID.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes (crud_party_post)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (crud_party_get)
### Search for party [GET /party{?first_name,last_name,second_name,birth_date,tax_id,phone_number,starting_after,ending_before,limit}]
Methods returns list of parties.
+ Parameters
+ first_name: Петро (string, required)
+ last_name: Іванов (string, required)
+ second_name: Миколайович (string, optional)
+ birth_date: `1991-08-19T00:00:00.000Z` (string, required) - ISO Datetime.
+ tax_id: 3126509816 (string, optional)
+ phone_number: `+380508887700` (string, optional)
+ limit: 20 (number) - A limit on the number of objects to be returned, between 1 and 100. Default: 50.
+ starting_after: 56c31536a60ad644060041af (string, optional) - A cursor to fetch next page. Taken from collection response.
+ ending_before: 56c31536a60ad644060041aa (string, optional) - A cursor to fetch previous page. Taken from collection response.
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_Collection)
+ data (array[`crud_party_get`])
### Get party details [GET /party/{id}]
Methods returns party details by ID.
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_party_get`)
## Employees [/employees]
### Create new employee [POST]
Method to create new employee record for the MSP.
`party_id`, `devision_id` and msp_id should already exist.
+ Request (application/json)
+ Attributes (crud_employee_post)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (crud_employee_get)
### Update employee [PUT /employees/{id}]
This method to update the employee info by ID.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes (crud_employee_post)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (crud_employee_get)
### Search for an Employee [GET /employees{?party_id,msp_id,division_id,employee_type,is_active,status,starting_after,ending_before,limit}]
Methods returns list of employees.
+ Parameters
+ `party_id`: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - user_id of a doctor.
+ msp_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MSP ID.
+ division_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - division ID.
+ employee_type: doctor (enum)
- doctor
- hr
- admin
- owner
- accountant
+ is_active: true (boolean, required)
+ status: approved (enum)
- approved
- pending_approval
- closed
+ limit: 20 (number) - A limit on the number of objects to be returned, between 1 and 100. Default: 50.
+ starting_after: 56c31536a60ad644060041af (string, optional) - A cursor to fetch next page. Taken from collection response.
+ ending_before: 56c31536a60ad644060041aa (string, optional) - A cursor to fetch previous page. Taken from collection response.
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_Collection)
+ data (array[crud_employee_get])
### Get Employee details [GET /employees/{id}]
Methods returns employee details by ID.
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (crud_employee_get)
### Get Employee Request by ID [GET /employee_requests/{id}]
This service should be used with `access_token` authetification method.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Employee_Request_Details)
### Get Employee Request by ID and Token [GET /employee_requests/{id}{?token}]
This service should be used by invitation recipient that does not have `access_token`.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ `token`: `5241744750e8c2df4897c0d35775d9a2` (string, optional) - the secret token to ensure the resolving is made by the User
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Employee_Request_Details)
### Approve the Employee Request [PATCH /employee_requests/{id}/actions/approve]
Expected that this end-point will be called from the eHealth invitations UI.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Headers
X-CSRF-Token: my-csrf-token
+ Attributes (object)
+ `user` (object, optional) - User that should be created (if invitation recipient doesn't have account in eHealth)
+ login: [email protected] (string, required)
+ password: notasecret (string, required)
+ `token`: `5241744750e8c2df4897c0d35775d9a2` (string, optional) - the secret token to ensure the resolving is made by the User.
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Employee_Request_Short)
### Decline the Employee Request [PATCH /employee_requests/{id}/actions/decline]
Expected that this end-point will be called from the Invitations UI.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Headers
X-CSRF-Token: my-csrf-token
+ Attributes (object)
+ `token`: `5241744750e8c2df4897c0d35775d9a2` (string, optional) - the secret token to ensure the resolving is made by the User.
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Employee_Request_Short)
## Doctors [/doctors]
### Create new doctor [POST]
Method to create new record in the employee_doctor table
Limitations:
* only one doctor can be registered for one employee record
+ Request (application/json)
+ Attributes (DoctorNew)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`crud_DoctorNew_get`)
### Get Doctor Details by ID [GET /doctors/{id}]
This method allows to fetch doctor record details by ID.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_DoctorNew_get`)
### Update Doctor [PATCH /doctors/{id}]
This method to update the Doctor related information.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes (DoctorNew)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_DoctorNew_get`)
## Legal Entities [/legal_entities]
### Get Legal Entities List [GET /legal_entities{?edrpou,type,status,legal_form,owner_property_type}]
+ Parameters
+ edrpou: 5432345432 (string, optional)
+ type (enum, optional)
- MSP
- MIS
+ status: VERIFIED (enum, optional)
- VERIFIED
- NOT_VERIFIED
+ owner_property_type: state (enum, optional)
- STATE
- PRIVATE
+ legal_form: `ПІДПРИЄМЕЦЬ-ФІЗИЧНА ОСОБА` (enum, optional)
- ПІДПРИЄМЕЦЬ-ФІЗИЧНА ОСОБА
- АКЦІОНЕРНЕ ТОВАРИСТВО
- ВІДКРИТЕ АКЦІОНЕРНЕ ТОВАРИСТВО
- ЗАКРИТЕ АКЦІОНЕРНЕ ТОВАРИСТВО
- РЕЛІГІЙНА ОРГАНІЗАЦІЯ
- ІНШІ ОРГАНІЗАЦІЙНО-ПРАВОВІ ФОРМИ
+ Response 200 (application/json)
+ Attributes (Response_Collection)
+ data (array[crud_legal_entity_get])
### Get Legal Entity Details by ID [GET /legal_entities/{id}]
+ Parameters
+ id: `1341234` (string)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_legal_entity_get`)
### Create Legal Entity [POST]
+ Request (application/json)
+ Attributes (crud_legal_entity_post)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_legal_entity_get`)
### Update Legal Entity [PATCH /legal_entities/{id}]
+ Parameters
+ id: `24352342` (string, required)
+ Request (application/json)
+ Attributes (crud_legal_entity_patch)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_legal_entity_get`)
## Divisions [/divisions]
### Create new division [POST]
Method to create new division record.
+ Request (application/json)
+ Attributes (`Division`)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`crud_division_get`)
### Update division [PATCH /divisions/{id}]
This method to update the division info by ID.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes (`Division`)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_division_get`)
### Search Divisions [GET /divisions/{?type,legal_entity_id}]
Methods returns list of legal entity divisions.
+ Parameters
+ type: clinic (string, optional)
+ `legal_entity_id`: 314083428 (string, optional)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_Collection)
+ data (array[`crud_division_get`])
### Get division details [GET /divisions/{id}]
Methods returns Division details by ID.
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_division_get`)
## Medical Service Providers [/msp]
### Create new msp [POST]
Method to create new record in the msp table
+ Request (application/json)
+ Attributes (`crud_msp_post`)
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`crud_msp_get`)
### Get MSP Details by ID [GET /msp/{legal_entity_id}]
This method allows to fetch msp record details by ID.
+ Parameters
+ legal_entity_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_msp_get`)
### Update MSP [PATCH /msp/{legal_entity_id}]
This method to update the MSP related information.
+ Parameters
+ legal_entity_id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Attributes (`crud_msp_patch`)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (`crud_msp_get`)
# Group Internal. Reports
## Declarations [/reports/declarations]
### Get Declarations Histogram stats [GET /reports/declarations{?start_date,end_date,doctor_id,msp_id}]
Methods returns agregated numbers of declarations.
+ Parameters
+ start_date: 2017-01-28 (string, required)
+ end_date: 2017-02-28 (string, required)
+ doctor_id: b075f148-7f93-4fc2-b2ec-2d81b19a9b7b (string, optional)
+ msp_id: b075f148-7f93-4fc2-b2ec-2d81b19a9b7b (string, optional)
+ Request (application/json)
+ Headers
Authorization: Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (array [Declaration_Report])
# Group Internal. Global parameters and Products
## Global parameters [/global_parameters]
### Get Global Parameters [GET]
Methods returns global parameters for declarations.
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Global_Parameters)
# Group Public. Medical Service Provider Integration Layer
## oAuth [/api/oauth]
### Show Login UI [GET /api/oauth/ui{?client_id,redirect_url,scope,response_type}]
You MUST redirect your users to this URL to obtain oAuth Code Grant (which is later exchanged to Access Token).
User will see rendered login page, which structure differ by a list of requested scopes and security measures applied by DevOps team.
For security purposes, we will set `X-Frame-Options: deny` header that will disallow opening this page in an iframe.
+ Parameters
+ client_id: `mis-001` (string, required) - Medical Information System ID issued upon integration request. Used to identify application developer.
+ redirect_url: http://example.com/ (string, required) - URL where user will be redirected after authentification. This url will receive `code` and `state` parameters in query string.
+ scope: `capitation_contracts:view capitation_contracts:create patients:view patients:create` (string, required) - List of scopes that is required in application business logic, separated by space. Different login forms will be shown based on scopes that you requested.
+ response_type: code (enum, required) - Response type, only `code` is supported.
+ Response 200 (text/html; charset=UTF-8)
+ Headers
X-CSRF-Token: my-csrf-token
### Exchange oAuth Code Grant to Access Token [POST /api/oauth/tokens]
After obtaining oAuth Code Grant, it should be exchanged to an `access_token` **on your back-end**.
General recommendations:
- Never expose `client_secret` to your front-end.
- Also we recommend to avoid pushing it to the application source code, to limit number of developers that have access to it.
Exposed client credentials may be blocked for a security reasons, you will need to contact administrator to receive a new credentials.
+ Request (application/json)
+ Headers
X-CSRF-Token: my-csrf-token
+ Attributes (object)
+ client_id: `mis-001` (string, required) - Medical Information System ID issued upon integration request. Used to identify application developer.
+ client_secret: `mis-001-secret-key` (string, required) - Medical Information System secret key issued upon integration request. Used to identify application developer.
+ code: 299383828 (string, required) - oAuth code grant.
+ `grant_type`: authorization_code (string, fixed) - oAuth Grant Type. Currently only `authorization_code` is supported.
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (Access_Token)
+ msp_id: null (string, optional)
### Use Refresh Token for Access Token extension [POST /api/oauth/tokens]
Currently `access_token` and `refresh_token` are configured to have same lifetime, so we don't expect you to refresh it.
In future, you will be able to refresh access tokens to extend `access_token` lifetime.
+ Request (application/json)
+ Headers
X-CSRF-Token: my-csrf-token
Authorization: Bearer mF_9.B5f-4.1JqM
+ Attributes (object)
+ client_id: `mis-001` (string, required) - Medical Information System ID issued upon integration request. Used to identify application developer.
+ client_secret: `mis-001-secret-key` (string, required) - Medical Information System secret key issued upon integration request. Used to identify application developer.
+ refresh_token: `my-oauth-refresh-token` (string, required) - oAuth refresh token.
+ `grant_type`: refresh_token (string, fixed) - oAuth Grant Type. Currently only `authorization_code` is supported.
+ Response 201 (application/json)
+ Attributes (Response_OK)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (Access_Token)
+ msp_id: null (string, optional)
### Set an oAuth Access Token Context [PATCH /api/oauth/tokens/{access_token}]
Set a `:msp_id` context for user `:access_token`.
+ Parameters
+ access_token: `my-oauth-token` (string, required) - oAuth access token.
+ Request (application/json)
+ Attributes
+ msp_id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, optional)
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (Access_Token)
+ msp_id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
## OTP Verification [/api/otp_verifications]
Method is used to verify that provided in declarartion request phone number is valid and is in service
### Initialize OTP Verification [POST]
+ Request (application/json)
+ Headers
Authorization: Bearer mF_9.B5f-4.1JqM
+ Attributes (object)
+ `phone_number`: `+380508887700` (string, required)
+ Response 200 (application/json)
+ Attributes (Response__Process_OK)
+ data (OTP)
### Complete OTP Verification [PATCH /api/otp_verifications/{phone_number}/actions/complete]
+ Parameters
+ `phone_number`: `+380508887700` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer mF_9.B5f-4.1JqM
+ Attributes (object)
+ code: 395105 (number)
+ Response 200 (application/json)
+ Attributes (Response__Process_OK)
+ data (OTP)
### Find Verifications by Phone Number [GET /api/otp_verifications/{phone_number}]
+ Parameters
+ `phone_number`: `+380508887700` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer mF_9.B5f-4.1JqM
+ Response 200 (application/json)
+ Attributes (Response_OK)
+ data (OTP)
## Declaration Requests [/api/declaration_requests]
[Declaration Request]() is a life-cycle entity that is used to perform operations on [Declarations]().
After declaration request is signed and/or verified (depends on verification logic) it will be automatically moved to [Declarations]().
### Get Declaration Requests List [GET /api/declaration_requests{?employee_id,legal_entity_id,status,starting_after,ending_before,limit}]
Use this method to obrain list of Declaration Requests for an `empolee_id`. If you want to reduce amount of data that is going trough your application, use `status` filter and show only requests that Doctor is interested in current UI section.
Also we suggest use `employee_id` and `legal_entity_id` to make sure that end-user understands context of actions that he or she will perform.
Method returns shortened details, to obtain full information - get Declaration Request it by it's ID.
+ Parameters
+ `employee_id`: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - user_id of a doctor.
+ `legal_entity_id`: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, optional) - MSP ID.
+ status: new (enum, optional)
- new
- pending
+ limit: 20 (number) - A limit on the number of objects to be returned, between 1 and 100. Default: 50.
+ starting_after: 56c31536a60ad644060041af (string, optional) - A cursor to fetch next page. Taken from collection response.
+ ending_before: 56c31536a60ad644060041aa (string, optional) - A cursor to fetch previous page. Taken from collection response.
+ Request (application/json)
+ Headers
Authorization: Bearer mF_9.B5f-4.1JqM
+ Response 200 (application/json)