forked from shamblesides/pdkapi-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapiary.apib
More file actions
8377 lines (6779 loc) · 288 KB
/
Copy pathapiary.apib
File metadata and controls
8377 lines (6779 loc) · 288 KB
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: https://panel-id.pdk.io/api
# PDK Panel API
The PDK Panel API provides for programmatic access to CRUD operations on entities and a realtime event stream from the PDK Access Control system.
The API conforms to many of the tenets of the REST style architecture and fully embraces the HTTP standard to fulfill many of these.
* Stateless
* Cacheable
* A URL identifies a Resource
* Operations conveyed implicitly through HTTP verbs
This drives certain uniform architectural attributes of the API.
> Where the documentation refers to `panel-id` this must be substituted with the actual serial number of your cloud node.
> If the cloud node serial number was 10702AG, then `panel-id` would be replaced with `panel-10702AG`.
# Authentication
Authenticating to this stateless API is handled by including an HTTP Authentication header in each request.
Before making any requests to the panel's API endpoint you will need a Bearer token.
This token represents your application's permission to access the API as delegated by the user.
For instructions on retrieving a token for communicating with a panel's API, see the [Auth Server API documentation](http://docs.pdkauthapi.apiary.io/). There are many libraries that support OpenID Connect protocol which is used for authentication. Please check [this link](https://openid.net/developers/libraries/) to see the list with some of them.
Because the API is stateless, this Bearer token must be included in every request to the API.
The Authorization header MUST be of the following format:
`Authorization: Bearer {token-value}`
# Resource Operations
Standard CRUD operations on resources are performed using HTTP verbs.
* GET - Retrieve a resource, never modifies data.
* POST - Create a resource. All required fields must be specified. In the case where one of the optional parameters is not specified, its default value will be used.
* PUT - Update a resource. Requires whole resource body to be specified.
* DELETE - Delete a resource.
# Cache Headers
The current state of a resource is identified by standard HTTP caching mechanisms in the response to a requested resource (e.g. ETag, Last-Modified, cache-control).
These headers can be used for change detection and intermediate caching.
Most HTTP stacks (including your browser address bar) automatically deal with caching headers in a bandwidth, proxy, and user-friendly way.
# URI Format
Resource URIs will generally follow a format similar to those shown below.
* Resource Collection - `https://panel-id.pdk.io/api/{resource-name}`
Example - `https://panel-id.pdk.io/api/persons`
* Specific Resource - `https://panel-id.pdk.io/api/{resource-name}/{id}`
Example - `https://panel-id.pdk.io/api/persons/1`
* Related Resource Collection - `https://panel-id.pdk.io/api/{resource-name}/{id}/{related-resource}`
Example - `https://panel-id.pdk.io/api/persons/1/groups`
* Specific Related Resource - `https://panel-id.pdk.io/api/{resource-name}/{id}/{related-resource}/{id}`
Example - `https://panel-id.pdk.io/api/persons/1/groups/2`
# Pagination
Most of calls that return collections return paginated results in order to decrease panel server load
(see `page` and `per_page` url query parameters).
Response contains link headers with links to first, last, next and previous pages of results,
which are specified in `first`, `last`, `next` and `prev` links accordingly.
For example, calling `GET https://panel-id.pdk.io/api/persons?page=1&per_page=5` will lead for the following headers:
```
Link: <https://panel-id.pdk.io/api/persons?per_page=5>; rel="first",
<https://panel-id.pdk.io/api/persons?page=3?per_page=5>; rel="prev",
<https://panel-id.pdk.io/api/persons?page=3&per_page=5>; rel="next",
<https://panel-id.pdk.io/api/persons?page=2&per_page=5>; rel="last"
X-Total-Count: 11
```
# Content type
Content type is set to `application/json` for all API calls.
# Response Codes
## HTTP Codes
* `200` - OK status with JSON body
* `204` - OK status without body
* `400` - Bad Request
* `401` - Unauthorized
* `403` - Forbidden
* `404` - Not Found
* `422` - Unprocessable Entity
* `500` - Internal Server Error
## Error message format
Error messages provide a human-readable description. For now, only English language is supported. Localization support will come in next releases.
{
"message" : "Human-friendly error message",
"errors": {
"field": "Human-friendly error message related to certain field (optional)"
}
}
# Metadata
*Introduced in API v1.6.3*
Certain updatable entities ([Person](#reference/persons), [Group](#reference/groups), [Devices](#reference/devices)) have a `metadata` property.
This property is opaque storage that can be leveraged by API consumers to store application-specific information.
A common use case is to store a correlation key that associates a pdk entity to an entity in the application database.
This property can be set to any valid JSON value, can not be null, defaults to an empty object `{}`, and there is a limit of 10KB on the size of the data stored here.
Once data is stored here, it will be provided with the entity any time it is retrieved via the REST API or sent in a message via the Stream Oriented API.
# Roles
Roles permissions have hierarchical structure. List of possible roles given below:
* `Reporter` has read-only access for Persons, Groups entities.
* `Manager` in addition to `Reporter` permissions has write access for Persons and Groups entities.
* `Admin` in addition to `Manager` permissions has write access for Persons, Groups, System Events, Auto Open Rules, Floor Groups entities.
* `Integrator` in addition to `Admin` permissions can change hardware configuration (Devices, Connections, Config and Websocket API commands).
* `Sysop` in addition to `Admin` permissions can change hardware configuration (Devices, Connections, Config and Websocket API commands).
# Group Search
The functionality is available for all roles. For [Reporter, Manager] roles search results will be filtered by user's partition.
### Global Search [GET /search?page={page}&per_page={per_page}&sort={sort}&q={q}]
+ Parameters
+ q (optional, string) ... Url-encoded query string. Search will be done in the following entities: Person (`firstName`, `lastName` and `cardNumber`), Group (`name`), Floor Group (`name`). Minimum length is `1` character, maximum length is `70` characters.
+ page (optional, number)
Number of page to return, started from `0`.
+ Default: `0`
+ per_page (optional, number)
Count of items per page. An integer from `1` to `100`.
+ Default: `10`
+ sort (optional, enum[string])
Sorting order. Entities are sorted by `name` values.
+ Default: `asc`
+ Members
+ `asc`
+ `desc`
+ Request
+ Headers
Authorization: Bearer {token}
+ Response 200 (application/json)
+ `id` (required, number) ... Numeric `id` of entity.
+ `type` (required, enum[string]) ... Type of entity.
+ Members
+ `person`
+ `group`
+ `floorGroup`
+ `name` (required, string) ... Entity name.
+ `description` (required, string) ... Entity description (will be equal to person's card number in case of search by card number).
+ `image` (required, string) ... Person photo URL. `null` will be returned if Person has no photo or entity is not a Person.
+ Headers
Link: <https://panel-id.pdk.io/api/search?page=1&per_page=10>; rel="next", <https://panel-id.pdk.io/api/search?page=2&per_page=10>; rel="last"
X-Total-Count: 11
+ Body
[
{
"id": 10,
"type": "person",
"name": "Ted Froëdington",
"description": "654321123456",
"image": "http://url"
}
]
+ Response 400 (application/json)
+ Response 401 (application/json)
# Group Persons
A person entity represents the attributes of a person that will be interacting with the access control system.
These attributes include the person's first and last names, a list of their credentials, rules that apply to them, and a list of group memberships, among others.
The functionality is available for [Sysop, Integrator, Admin, Manager] roles. Retrieving operations are also available for [Reporter] role.
All operations consider user's partition. Created Persons will be bound to user's partition by default.
For [Reporter, Manager] roles Persons will be filtered by their partition.
[Admin, Integrator, Sysop] users can change Person's partition.
## Persons Collection [/persons?page={page}&per_page={per_page}&sort={sort_order}]
### Retrieve all Persons [GET /persons?page={page}&per_page={per_page}&sort={sort}&include={include}]
+ Parameters
+ page (optional, number)
Number of page to return, started from `0`.
+ Default: `0`
+ per_page (optional, number)
Count of items per page. An integer from `1` to `100`.
+ Default: `10`
+ sort (optional, enum[string])
Sorting order. Persons are sorted by `lastName`, `firstName` values.
+ Default: `asc`
+ Members
+ `asc`
+ `desc`
+ `ascByFirstName`
+ `descByFirstName`
+ include (optional, enum[string])
The parameter allows to get a related entity for the person.
+ Members
+ `groups`
+ `credentials`
+ `partition`
+ `rules`
+ Request
+ Headers
Authorization: Bearer {token}
+ Response 200 (application/json)
+ `id` (required, number) ... Person's id.
+ `firstName` (required, string) ... Person's first name.
+ `lastName` (required, string) ... Person's last name.
+ `photoUrl` (optional, string) ... Person's account photo URL. `null` will be returned if Person has no photo.
+ `partition` (required, number or object) ... Partition that the Person is bound to.
+ `activeDate` (optional, string) ... The date since Person's data should be processed by server in format `YYYY-MM-DD`.
+ `expireDate` (optional, string) ... The date till Person's data should be processed by server in format `YYYY-MM-DD`.
+ `pin` (optional, string) ... The PIN that is bound to specific Person.
+ `duressPin` (optional, string) ... The duress PIN that is bound to specific Person. Defaults to '9' + PIN value.
+ `enabled` (required, boolean) ... Flag indicating whether should or should not the Person's data be processed by server.
+ `groups` (optional, array) ... List of person groups.
+ `credentials` (optional, array) ... List of person credentials.
+ `metadata` (optional, object) ... An optional piece of opaque metadata stored with the entity.
+ `customAttributes` (required, object) ... A customAttributes of the entity.
+ Headers
Link: <https://panel-id.pdk.io/api/persons?page=1&per_page=10>; rel="next", <https://panel-id.pdk.io/api/persons?page=2&per_page=10>; rel="last"
X-Total-Count: 11
+ Body
[
{
"id": 10,
"firstName": "Ted",
"lastName": "Froëdington",
"partition": 0,
"photoUrl": "http://example.com/usersImages/32224.jpg",
"metadata": {},
"customAttributes":
{
"arrayAttribute": [3],
"numberAttribute": 1,
"stringAttribute": "st",
"toggleAttribute": true,
"dropdownAttribute": "id1"
"fieldGroupAttribute": {
"stringAttribute": "string value",
"toggleAttribute": true
}
}
}
]
+ Response 401 (application/json)
### Delete multiple Persons [POST /persons/bulk-delete]
+ Request (application/json)
+ persons (required, array) ... Array consisting of Ids of the persons to be deleted.
+ Headers
Authorization: Bearer {token}
+ Body
{
"persons": [1, 2, 3]
}
+ Response 200 (application/json)
+ `deleted` (required, array) ... Persons that were deleted.
+ Body
{
"deleted": [1, 3]
}
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
## Person [/persons/{person_id}]
+ Model
+ `firstName` (required, string) ... Person's first name. Minimum length is `1` character, maximum length is `35` characters.
+ `lastName` (required, string) ... Person's last name. Minimum length is `1` character, maximum length is `35` characters. `firstName` + `lastName` combination should be unique.
+ `partition` (optional, number) ... Partition that the Person is bound to. Could be set only by Admin and higher.
+ `activeDate` (optional, string) ... The date time since Person's data should be processed by server in format `YYYY-MM-DDTHH:mm:ss`.
+ `expireDate` (optional, string) ... The date time till Person's data should be processed by server in format `YYYY-MM-DDTHH:mm:ss`.
+ `pin` (optional, string) ... The PIN that is bound to specific Person.
+ `duressPin` (optional, string) ... The duress PIN that is bound to specific Person. Defaults to '9' + PIN value.
+ `enabled` (optional, boolean) ... Flag indicating whether should or should not the Person's data be processed by server.
+ `metadata` (optional, object) ... An optional piece of opaque metadata stored with the entity
+ `email` (optional, string) ... The email that is bound to specific Person.
+ `customAttributes` (optional, object) ... The list of the custom attributes for specific Person. The schema is used from bound partition.
+ Headers
Authorization: Bearer {token}
+ Body
{
"firstName": "Ted",
"lastName": "Froëdington",
"partition": 0,
"metadata": {},
"customAttributes": {
"arrayAttribute": [3]
"numberAttribute": 1,
"stringAttribute": "st",
"toggleAttribute": true,
"dropdownAttribute": "id1"
"fieldGroupAttribute": {
"stringAttribute": "string value",
"toggleAttribute": true
}
}
}
### Retrieve a Person [GET]
+ Parameters
+ person_id (required, number) ... Numeric `id` of the Person to perform the action on.
+ Request
+ Headers
Authorization: Bearer {token}
Want-Digest: sha-256 [optional]
+ Response 200 (application/json)
+ `firstName` (required, string) ... Person's first name.
+ `lastName` (required, string) ... Person's last name.
+ `partition` (required, number) ... Partition that the Person is bound to.
+ `photoUrl` (optional, string) ... Person's account photo URL. `null` will be returned if Person has no photo.
+ `activeDate` (optional, string) ... The date since Person's data should be processed by server in format `YYYY-MM-DDTHH:mm:ss`.
+ `expireDate` (optional, string) ... The date till Person's data should be processed by server in format `YYYY-MM-DDTHH:mm:ss`.
+ `enabled` (required, boolean) ... Flag indicating whether should or should not the Person's data be processed by server.
+ `pin` (optional, string) ... The PIN that is bound to specific Person.
+ `duressPin` (optional, string) ... The duress PIN that is bound to specific Person. Defaults to '9' + PIN value.
+ `email` (optional, string) ... The email that is bound to specific Person.
+ `cards` (required, array) ... Cards that belongs to the Person. Empty array will be returned if Person has no cards.
+ `groups` (required, array) ... Groups that the Person belongs to. Empty array will be returned if Person does not belong to any Group.
+ `credentials` (required, array) ... Credentials that belong to the Person. Empty array will be returned if Person has no credentials.
+ `metadata` (optional, object) ... An optional piece of opaque metadata stored with the entity
+ `customAttributes` (optional, object) ... The list of the custom attributes for specific Person. The schema is used from bound partition.
+ Body
{
"id": 1,
"firstName": "Ted",
"lastName": "Froëdington",
"partition": 0,
"photoUrl": "http://example.com/images/32224.jpg",
"metadata": {},
"cards": [
{
"id": 1,
"cardNumber": 12345,
"description": "some text"
}
],
"groups": [
{
"id": 1,
"name": "groupName"
}
],
"mobileCredentials": [
{
"id": 1,
"email": "mobile.credentials@email.com"
}
]
}
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
### Create a Person [POST /persons]
+ Request (application/json)
[Person][]
+ Response 200 (application/json)
+ `id` (required, number) ... Id of created entity.
+ Body
{
"id": 1
}
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
+ Response 422 (application/json)
### Update a Person [PUT]
+ Parameters
+ person_id (required, number) ... Numeric `id` of the Person to perform the action on.
+ Request (application/json)
+ `firstName` (required, string) ... Person's first name. Minimum length is `1` character, maximum length is `35` characters.
+ `lastName` (required, string) ... Person's last name. Minimum length is `1` character, maximum length is `35` characters. `firstName` + `lastName` combination should be unique.
+ `partition` (optional, number) ... Partition that the Person is bound to. Could be set only by Admin and higher. In case, a person has custom attributes and the partition is changed. Custom attributes of the person will be cast to new schema.
+ `activeDate` (required, string) ... The date since Person's data should be processed by server in format `YYYY-MM-DDTHH:mm:ss`. `null` should be passed if date is not set.
+ `expireDate` (required, string) ... The date till Person's data should be processed by server in format `YYYY-MM-DDTHH:mm:ss`. `null` should be passed if date is not set.
+ `pin` (required, string) ... The PIN that is bound to specific Person.
+ `duressPin` (required, string) ... The duress PIN that is bound to specific Person. Defaults to '9' + PIN value.
+ `enabled` (required, boolean) ... Flag indicating whether should or should not the Person's data be processed by server.
+ `email` (optional, string) ... The email that is bound to specific Person.
+ `metadata` (optional, object) ... An optional piece of opaque metadata stored with the entity
+ `customAttributes` (optional, object) ... The list of the custom attributes for specific Person. The schema is used from bound partition.
+ `mode` (optional, enum) ... Values: `merge`, `rewrite`. There is a mode for merging customAttributes. The `rewrite` mode is default.
+ Headers
Authorization: Bearer {token}
Digest: digest [optional]
+ Body
{
"firstName": "Ted",
"lastName": "Froëdington",
"partition": 0,
"activeDate": "2016-05-05",
"expireDate": "2017-05-05",
"pin": null,
"duressPin": null,
"enabled": true,
"metadata" { "dbId": "ed1479c1-262f-4523-8726-24a858b1b77f" }
}
+ Response 204
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
+ Response 422 (application/json)
### Delete a Person [DELETE]
Person removal leads to all Person's Rules removal.
+ Parameters
+ person_id (required, number) ... Numeric `id` of the Person to perform the action on.
+ Response 204
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
## Persons Import [/persons/import]
Please use a digest from 'import/preview' for correct import. Import also supports `customAttributes` field.
### Import csv [POST]
+ Request (application/json)
+ `csv` (required, string) ... String `csv` data.
+ `partition` (optional, number) ... An id of the partition.
+ `upsert` (optional, boolean) ... A flag to apply changes.
+ `resolutions` (optional, array) ... A list of the resolutions for existing conflicts.
+ Headers
Authorization: Bearer {token}
Digest: {digest}
+ Body
{
"csv": "First Name,Last Name,Cards,Groups,Email,Touch,Token,Unredeemed Touch,Unredeemed Token,Enabled,Pin,Duress Pin,Active Date,Expire Date,Partitiontest,testLastName,,,test@pdk.io,1,1,,,,,,2021-01-01T10:00:00Z,2021-01-01T10:00:00Z,newOne",
"partition": 0,
"upsert": true,
"resolutions": [
{
"line": 2,
"decision": "create"
}
]
}
+ Response 204
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
## Persons Import Preview [/persons/import/preview]
The endpoint returns info of an import result and a list of the confilcts. A user should resolve conflicts.
Also, the endpoint returns digest of the result.
### Import csv preview [POST]
+ Request (application/json)
+ `csv` (required, string) ... String `csv` data.
+ `partition` (optional, number) ... An id of the partition.
+ `upsert` (optional, boolean) ... A flag to apply changes.
+ Headers
Authorization: Bearer {token}
Want-Digest: sha-265
+ Body
{
"csv": "First Name,Last Name,Cards,Groups,Email,Touch,Token,Unredeemed Touch,Unredeemed Token,Enabled,Pin,Duress Pin,Active Date,Expire Date,Partitiontest,testLastName,,,test@pdk.io,1,1,,,,,,2021-01-01T10:00:00Z,2021-01-01T10:00:00Z,newOne",
"partition": 0,
"upsert": true
}
+ Response 204
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
## Person Photo [/persons/{person_id}/photo]
### Update person photo [PUT]
+ Request (application/json)
+ `base64` (required, string) ... Value in base64 format. To remove Person's photo null should be based.
+ Headers
Authorization: Bearer {token}
+ Body
{
"base64": "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24="
}
+ Response 204
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
## Person Cards [/persons/{person_id}/cards]
The functionality is available for [Sysop, Integrator, Admin, Manager] roles. Retrieving Cards is also available for the [Reporter] role.
[Manager, Reporter] have an access to Cards that bound to Persons from their own partition only.
+ Model
+ `cardNumber` (required, number) ... Card number. Must be unique among all persons. Maximum value is 99999999999.
+ `description` (optional, string) ... Card description. Minimum length is `1` character, maximum length is `255` characters.
+ Headers
Authorization: Bearer {token}
+ Body
{
"cardNumber": 123,
"description": "Card description"
}
### Retrieve all Cards [GET /persons/{person_id}/cards?page={page}&per_page={per_page}&sort={sort}]
+ Parameters
+ person_id (required, number)
Numeric `id` of the Person to perform the action on.
+ page (optional, number)
Number of page to return, started from `0`.
+ per_page (optional, number)
Count of items per page. An integer from `1` to `100`.
+ sort (optional, enum[string])
Sorting order. Cards are sorted by `cardNumber` values.
+ Default: `asc`
+ Members
+ `asc`
+ `desc`
+ Request
+ Headers
Authorization: Bearer {token}
+ Response 200 (application/json)
+ `id` (required, number) ... Numeric `id` of the Card.
+ `cardNumber` (required, number) ... Card number.
+ `description` (optional, string) ... Card description. Maximum length is `255` characters.
+ Headers
Link: <https://panel-id.pdk.io/api/cards?page=1&per_page=10>; rel="next", <https://panel-id.pdk.io/api/cards?page=2&per_page=10>; rel="last"
X-Total-Count: 11
+ Body
[
{
"id": 1,
"cardNumber": 12321,
"description": "myCard"
}
]
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
### Retrieve a Card [GET /persons/{person_id}/cards/{card_id}]
+ Parameters
+ person_id (required, number) ... Numeric `id` of the Person to perform the action on.
+ Request
+ Headers
Authorization: Bearer {token}
+ Response 200 (application/json)
+ `id` (required, number) ... Numeric `id` of the Card.
+ `cardNumber` (required, number) ... Card number.
+ `description` (optional, string) ... Card description. Maximum length is `255` characters.
+ Body
{
"id": 1,
"cardNumber": 123,
"description": "Card description"
}
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
### Create a Card [POST]
+ Parameters
+ person_id (required, number) ... Numeric `id` of the Person to perform the action on.
+ Request (application/json)
[Person Cards][]
+ Response 204
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
### Delete a Card [DELETE /persons/{person_id}/cards/{card_id}]
+ Parameters
+ person_id (required, number) ... Numeric `id` of the Person to perform the action on.
+ Request
+ Headers
Authorization: Bearer {token}
+ Response 204
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
## Person Credentials [/persons/{person_id}/credentials]
In this <a href="https://pdkauthapi.docs.apiary.io/#reference/credentials/people/steps-to-create-touch,-token-credentials">instruction</a> you can find steps to create `touch and token` credentials in <b>2-steps</b>.
The functionality is available for [Sysop, Integrator, Admin, Manager] roles. Retrieving Credentials is also available for the [Reporter] role.
[Manager, Reporter] have an access to Credentials that bound to Persons from their own partition only.
### Retrieve all Credentials [GET /persons/{person_id}/credentials?page={page}&per_page={per_page}&sort={sort}]
+ Parameters
+ person_id (required, number)
Numeric `id` of the Person to perform the action on.
+ page (optional, number)
Number of page to return, started from `0`.
+ Default: 0
+ per_page (optional, number)
Count of items per page. An integer from `1` to `100`.
+ Default: 100
+ sort (optional, enum[string])
Sorting order. Mobile Сredentials are sorted by the `email` value.
+ Default: `asc`
+ Members
+ `asc`
+ `desc`
+ Request (application/json)
+ Headers
Authorization: Bearer {token}
+ Response 200 (application/json)
+ `id` (required, number) ... Numeric `id` of the Card.
+ `personId` (required, number) ... Id of person,
+ `credentialNumber` (required, number) ... Credential number.
+ `types` (required, array of string) ... Types of credential [`token`, `touch`, `card`].
+ `description` (optional, string) ... Card description. Maximum length is `255` characters.
+ Headers
Link: <https://panel-id.pdk.io/api/mobile_credentials?page=1&per_page=10>; rel="next", <https://panel-id.pdk.io/api/mobile_credentials?page=2&per_page=10>; rel="last"
X-Total-Count: 11
+ Body
[
{
"id": 1,
"personId": 12,
"credentialNumber": 722,
"description": "myCard"
"types": [
"token"
]
}
]
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
### Retrieve Credential [GET /persons/{person_id}/credentials/{id}]
+ Parameters
+ person_id (required, number)
Numeric `id` of the Person to perform the action on.
+ id (required, number)
Numeric `id` of the Credentials.
+ Request (application/json)
+ Headers
Authorization: Bearer {token}
+ Response 200 (application/json)
+ `id` (required, number) ... Numeric `id` of the Card.
+ `personId` (required, number) ... Id of person,
+ `credentialNumber` (required, number) ... Credential number.
+ `types` (required, array of string) ... Types of credential [`token`, `touch`, `card`].
+ `description` (optional, string) ... Card description. Maximum length is `255` characters.
+ Headers
Link: <https://panel-id.pdk.io/api/mobile_credentials?page=1&per_page=10>; rel="next", <https://panel-id.pdk.io/api/mobile_credentials?page=2&per_page=10>; rel="last"
X-Total-Count: 11
+ Body
{
"id": 1,
"personId": 12,
"credentialNumber": 722,
"description": "myCard"
"types": [
"token"
]
}
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
### Create Credentials [POST]
+ Parameters
+ person_id (required, number) - Numeric `id` of the Person to perform the action on.
+ Request (application/json)
+ `types` (required, array) - The list of the types.
+ `credentialNumber` (optional, number) - Number of the created credentials.
+ `description` (optional, string) - The description.
+ Headers
Authorization: Bearer {token}
+ Response 200 (application/json)
+ Attributes
+ id (required, number) - Numeric `id` of the created Credentials entry.
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
### Update Credentials [PUT /persons/{person_id}/credentials/{credential_id}]
+ Parameters
+ person_id (required, number) - Numeric `id` of the Person to perform the action on.
+ credential_id (required, number) ... Numeric `id` of the Credentials entity.
+ Request (application/json)
+ `types` (required, array) - The list of the types.
+ Headers
Authorization: Bearer {token}
+ Body
{
"types": "token"
}
+ Response 204 (application/json)
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
### Accept Credentials [POST /persons/{person_id}/credentials/{credential_id}/accept]
+ Parameters
+ person_id (required, number) ... Numeric `id` of the Person to perform the action on.
+ credential_id (required, number) ... Numeric `id` of the Credentials entity that should be accepted.
+ Request (application/json)
+ `inviteToken` (required, string) ... Invite token.
+ Headers
Authorization: Bearer {token}
+ Body
{
"inviteToken": "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24="
}
+ Response 200 (application/json)
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
### Delete Credentials [DELETE /persons/{person_id}/credentials/{credential_id}]
+ Parameters
+ person_id (required, number) ... Numeric `id` of the Person to perform the action on.
+ credential_id (required, number) ... Numeric `id` of the Mobile Credentials entity that should be deleted.
+ Request
+ Headers
Authorization: Bearer {token}
+ Response 204
+ Response 400 (application/json)
+ Response 401 (application/json)
+ Response 403 (application/json)
+ Response 404 (application/json)
## Person Rules Collection [/persons/{person_id}/rules]
#### List of access rules, event rules and elevator rules that apply to this Person.
The functionality is available for [Sysop, Integrator, Admin, Manager, Reporter] roles.
[Manager, Reporter] have an access to Rules that bound to Persons from their own partition.
[Manager] can change Rule's Doors list. Only Doors from [Manager]'s partition could be added. Any Door present in the Rule could be removed.
### Retrieve Rules Collection for a Person [GET /persons/{person_id}/rules?page={page}&per_page={per_page}&sort={sort}]
+ Parameters
+ person_id (required, number)
Numeric `id` of the Person to perform the action on.
+ page (optional, number)
Number of page to return, started from `0`.
+ per_page (optional, number)
Count of items per page. An integer from `1` to `100`.
+ sort (optional, enum[string])
Sorting order. Rules are sorted by `id` values.
+ Default: `asc`
+ Members
+ `asc`
+ `desc`
+ Request
+ Headers
Authorization: Bearer {token}
+ Response 200 (application/json)
+ Common parameters for all rule types
+ `id` (required, number) ... Numeric rule `id`.
+ `type` (required, enum[string])
Type of a given rule.
+ Members
+ `door`
+ `elevator`
+ `event`
+ `startTime` (required, string) ... Time when a rule performing should be enabled in `HH:MM` format.
+ `stopTime` (required, string) ... Time when a rule performing should be disabled in `HH:MM` format.
+ `recurring` (optional, array[string]) ... Days of week when a rule should be performed. Possible values: `Mon`, `Tue`, `Wed`, `Thu`, `Fri`, `Sat`, `Sun`.
+ `singleDate` (optional, string) ... Date when a rule should be performed in `YYYY-MM-DD` format. Only one field can be in the JSON at the same time `recurring` or `singleDate`.
+ Specific `door` rule type fields
+ `allow` (required, boolean) ... Flag which indicates if access granted or denied.
+ `doors` (required, array) ... Doors on which rule should be performed.
+ `authenticationPolicy` (optional, string)
Authentication policy that should be applied on the certain Device.
+ Default: `cardOnly`
+ Members
+ `cardOnly` - grant access by card only
+ `pinOnly` - grant access by PIN only
+ `cardOrPin` - grant access by either card or PIN
+ `cardAndPin` - grant access by both card and PIN
+ Specific `elevator` rule type fields
+ `floorGroups` (required, array) ... Floor Groups on which rule should be performed.
+ `authenticationPolicy` (optional, string)
Authentication policy that should be applied on the certain Device.
+ Default: `cardOnly`
+ Members
+ `cardOnly` - grant access by card only
+ `pinOnly` - grant access by PIN only
+ `cardOrPin` - grant access by either card or PIN
+ `cardAndPin` - grant access by both card and PIN
+ Specific `event` rule type fields
+ `name` (required, string) ... Rule name.
+ `triggerType` (required, enum[string])
Type of event on which action should be performed.