-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapiary.apib
2383 lines (1818 loc) · 75.1 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
# PayByPhone API
This is a list of PayByPhone Apis
## Response Codes
The common [HTTP Response Status Codes](http://tools.ietf.org/html/rfc7231#section-6) are used.
## Error Handling
Any code you write to call PayByPhone's APIs should expect to receive and handle errors from the service. A given error may be returned for multiple reasons, so it's a good idea to look at (and handle in code), the error messages returned with the error number.
400-series errors indicate that you cannot perform the requested action, the most common reasons being that you don't have permission or that a referred-to entity doesn't exist.
500-series errors indicate that a request didn't succeed, but may be retried. Though infrequent, these errors are to be expected as part of normal interaction with the service and should be explicitly handled with an exponential backoff algorithm. One such algorithm can be found at http://en.wikipedia.org/wiki/Truncated_binary_exponential_backoff.
Failed connection attempts should also be handled with exponential backoff.
## Versioning
Each endpoint in PayByPhone's API is separately versionable. The `X-Pbp-Version` header is used
to indicate which version of the endpoint the caller which to invoke. An example to invoke a
version 2 of a resource would be to add the following HTTP Header to the request `X-Pbp-Version: 2`
# Data Structures
## Money (object)
+ amount: `5.00` (number)
+ currencyCodeISO4217: `CAD` (string)
## QuoteItem (object)
+ quoteItemType: `parking` (string) - XXXXXXXX
+ name: `Parking` (string) - XXXXXXXX
+ costAmout (Money)
## GetParkingQuoteResponse (object)
+ locationNumber: `40002` (string) - XXXXXXXX
+ stallId: `123` (string) - XXXXXXXX
+ quoteDate: `2015-06-25T18:00:00-0000` (string) - XXXXXXXX
+ totalCost (Money) - XXXXXXXX
+ parkingAccountId: `56514ff5-44fc-463b-820f-1d47393e1703` (string) - XXXXXXXX
+ parkingStartTime: `2014-12-29T22:00:00-0000` (string) - XXXXXXXX
+ parkingExpiryTime: `2014-12-29T23:00:00-0000` (string) - XXXXXXXX
+ parkingDurationAdjustment (enum) - XXXXXXXX
+ NotAdjusted (string) - XXXXXXXX
+ DurationIncreased (string) - XXXXXXXX
+ DurationDecreased (string) - XXXXXXXX
+ DurationIncreasedPromptUserToConfirm (string) - XXXXXXXX
+ licensePlate: `ABC123` (string) - XXXXXXXX
+ quoteItems (array) - XXXXXXXX
+ (QuoteItem)
## PaymentAccount (object)
+ id: `+16046155905` (string) - E.164 phone number used to create user account.
+ maskedCardNumber: `411111------1111` (string) - Assigned by the API at the moment of creation.
+ paymentCardType: `DebitCard` (string) - Assigned by the API at the moment of creation.
+ nameOnCard: `JOHN L SMITH` (string) - Assigned by the API at the moment of creation.
+ expiryMonth: `2` (number) - Assigned by the API at the moment of creation.
+ expiryYear: `2018` (number) - Assigned by the API at the moment of creation.
+ startMonth: `2` (number) - Assigned by the API at the moment of creation.
+ startYear: `2012` (number) - Assigned by the API at the moment of creation.
+ issueNumber: `2` (number) - Assigned by the API at the moment of creation.
## PaymentAccounts (array)
+ (PaymentAccount) - An array of PaymentAccount objects
## CreatePaymentAccount (object)
+ countryCode (enum, required) - Country the card is registered in.
+ CA (string)
+ US (string)
+ AU (string)
+ FR (string)
+ CH (string)
+ GB (string)
+ cardNumber: `4111111111111111` (string, required) - The credit or debit card number.
+ expiryMonth: `2` (number, required) - Expiration month of the card.
+ expiryYear: `2018` (number, required) - Expiration year of the card.
+ nameOnCard: `JOHN L SMITH` (string) - The card holders name as it appears on the card.
+ cvv : `123` (string) - The Card Verification Value
+ issueNumber: `2` (number) - The issue number for the debit card.
+ startMonth: `2` (number) - Assigned by the API at the moment of creation.
+ startYear: `2012` (number) - Assigned by the API at the moment of creation.
# Group Identity And Access
## About
Identity And Access API provides Identity Management and Authorization resources
## Create user account [POST /identity/user/accounts]
Create a new User Account
**Response Codes**
- 201 - User account successfully created.
- 400 - Username or password does not meet validation requirements.
- 409 - Username is already in use.
+ Request (application/json)
+ Attributes
+ username: `+16046155905` (required, string) - E.164 formatted phone number
+ password: `1234` (required, string) - 6-20 character alphanumeric password
+ Body
{
"username": "+16046155905",
"password": "1234"
}
+ Response 201 (application/json)
+ Attributes
+ username: `+16046155905` (string) - E.164 phone number used to create user account.
+ userAccountId: `5fb93529-b3a1-486e-b23d-a14944bbe3f5` (string) - Assigned by the API at the moment of creation.
+ Body
{
"username": "+16046155905",
"userAccountId" : "5fb93529-b3a1-486e-b23d-a14944bbe3f5"
}
## Cancel the active user account [DELETE /identity/user/accounts/{userAccountId}]
**Possible Response Codes**
- 200 - User account successfully cancelled.
- 401 - The access token has expired or is invalid.
- 403 - The user account it not active and cannot be cancelled.
- 403 - The member it not authorized to modify the specified user account.
+ Parameters
+ userAccountId: `5fb93529-b3a1-486e-b23d-a14944bbe3f5` (required, string) - User account to be cancelled.
+ Response 200
## Change user account password [PUT /identity/user/accounts/{userAccountId}/password]
Change the password used to authenticate a user account
**Possible Response Codes**
- 202 - Request is being processed
- 400 - The request is invalid.
- 403 - Access Denied.
- 500 - Shit hit the fan exception.
**Possible events**
- UserAccountPasswordChanged
{
"UserAccountId":"5fb93529-b3a1-486e-b23d-a14944bbe3f5",
"$type":"UserAccountPasswordChanged"
}
- UserAccountPasswordChangedFailed
{
"UserAccountId":"5fb93529-b3a1-486e-b23d-a14944bbe3f5",
"FailureReason":"[CurrentPasswordIncorrectDoesNotMeetComplexityRequirements|UserNotFound|InternalServerError]",
"$type":"UserAccountPasswordChangedFailed
}
+ Parameters
+ userAccountId: `5fb93529-b3a1-486e-b23d-a14944bbe3f5` (required, string) - User account to be changed.
+ Request (application/json)
+ Attributes
+ userAccountId: `5fb93529-b3a1486eb23da14944bbe3f5` (required, string) - User account to be cancelled.
+ currentPassword: `1234` (required, string) - Current password of the user account.
+ newPassword: `5678` (required, string) - New password for the user account.
+ Body
{
"userAccountId": "8d21a912-561a-48ff-b31b-00d600a2544e",
"currentPassword": "1234",
"newPassword": "5678"
}
+ Response 202
+ Headers
Location: https://api.paybyphone.com/events/d92cfe7d-dd59-49d6-be1a-a3b3bb5d3e6a
## Get an access token and refresh token [POST /identity/token]
**Possible Response Codes**
- 200 - OK
- 400 - See Possible error codes
**Possible Error Codes**
- IncorrectUsername
- IncorrectPassword
- AccountLocked
- AccountSuspended
- `invalid_client`
+ Request Get token from Credentials
+ Attributes
+ `grant_type`: `password` (required, string) - The grant type
+ username: `+16046155905` (required, string) - The username corresponding to an existing user account
+ password: `iphone_app` (required, string) - The password that match the user account
+ `client_id`: `iphone_app` (required, string) - The client identifier
+ Headers
Content-Type: application/x-www-form-urlencoded
+ Body
grant_type=password
&username=%2B16046155905
&password=1234
&client_id={your_app_client_id}
+ Request Get token from refresh token
+ Attributes
+ `grant_type`: `refresh_token` (required, string) - The grant type
+ `refresh_token`: `+16046155905` (required, string) - The refresh token
+ `client_id`: `iphone_app` (required, string) - The client identifier
+ Headers
Content-Type: application/x-www-form-urlencoded
+ Body
grant_type=refresh_token
&refresh_token=F72ECD394B69405E95DCEA175D49A35D
&client_id={your_app_client_id}
+ Response 200 (application/json)
+ Attributes
+ `access_token`:`eyJ0eXAiOiJ....` (string) - Encoded access token
+ `token_type`:`bearer` (string) - Type of the token
+ `expires_in`:`1209599` (string) - Lifetime of the access token in seconds
+ `refresh_token`:`F72ECD394B69405E95DCEA175D49A35D` (string) - A refresh token - will be the same as the refresh token used in the request.
+ Body
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtZW1iZXJpZCI6IjViNWNjNmQ1LWNjZmEtNDc1OS04OGI0LTM1NTRmMTg0ZjZiYiIsImFjdGl2ZXVzZXJhY2NvdW50IjoiMWI3ZTdmYTAtZTI1Yi00OTM3LWI0MjEtYTNkMTAwZDQ5ZDdkIiwiaXNzIjoiUGF5QnlQaG9uZSBJZGVudGl0eSBBbmQgQWNjZXNzIiwiYXVkIjoiaHR0cDovL2FwaS5wYXlieXBob25lLmNvbSIsImV4cCI6MTQxOTAzMjI3NywibmJmIjoxNDE3ODIyNjc3fQ.dYc4bPdwA9OB4FJCaaSpAWplyxZozOlNTdZkhX7qgQE",
"token_type": "bearer",
"expires_in": 1209599,
"refresh_token": "F72ECD394B69405E95DCEA175D49A35D"
}
## Revoke a refresh token [DELETE /identity/refresh_token/{refresh_token_id}]
**Possible Response Codes**
- 204
- 400
- 401
- 404 - The refresh token could not be found for the authenticated user.
+ Parameters
+ refresh_token_id: `F72ECD394B69405E95DCEA175D49A35D` (required, string) - Refresh token to revoke
+ Response 204
## Recover password [POST /identity/user/accounts/password/recover]
**Possible Response Codes**
- 204
- 400
+ Request (application/json)
+ Attributes
+ username: `+16046155905` (required, string) - Username to recover password for.
+ language: `en-US` (required, enum[string]) - Language in which password recovery message should be sent.
+ Members
+ `en-US`
+ `en-GB`
+ `fr-FR`
+ `fr-CA`
+ Body
{
"username":"+16046155905",
"language":"en-US"
}
+ Response 202
# Group Parking
## Get current or historic parking sessions [/parking/accounts/{accountId}/sessions/?periodType=Current]
## Get a user's current/historic parking sessions [GET]
**Possible Response Codes**
- 200 - OK
- 400 - Bad Request
- 401 - Unauthorized
- 403 - Forbidden
+ Request
+ Header
Authorization: Bearer <token>
+ Parameters
+ accountId: `1b98d239-8de8-4111-9d7d-562fc31c193a` (required, string) - Parking account id.
+ periodType: 'Current' (required, enum[string]) -
+ Members
+ `Current`
+ `Historic`
+ since: `2015-09-01T16:16:00.000Z` (optional, string) - Date and time when to retrieve the parking sessions from.
+ offset: '0' (optional, int) - Offset should be more than 0.
+ limit: '10' (optional, int) - Limit should be more than 0 and less than 50.
+ Response 200
+ Attributes (application/json)
+ `parkingSessionId`:`de9bd239-44f3-483e-9fd4-7c98567da200` (string) - The parking session ID, this is needed if you want to extend an existing parking session (NOTE: this property will soon be renamed to parkingSessionId)
+ `locationId`: `5594` (string) - The Lot ID where the user is parked
+ `vehicle`: (required) - The vehicle information associated with the parking session
+ `id`: 1234 (required, int) - The ID of the vehicle that is parked.
+ `licensePlate`: `ABC123` (string) - The license plate of the vehicle that is parked
+ `jurisdiction`: `BC` (required, string) - Jurisdiciton the parked vehicle is registered in. Valid jurisdictions are Countries and Regions supported by API#Provinces
+ `countryCode`: `CA` (optional, string) - Country ISO 3166 code of the location.
+ `type`: `motorcycle` (required, string) - Vehicle Type. Valid types are: car, motorcycle, electricMotorcycle, heavyGoodsVehicle
+ `startTime`: `2015-09-01T16:16:00.000Z` (string) - The total duration of the parking session from the start-time
+ `stall`: `82445` (string) - Stall where the vehicle is parked if the parking session took place in a stall, null otherwise.
+ `rateOption`: (required) - The rate option details associated with the parking session
+ `ratePolicyId`: `5594` (required, string) - The identifier of the rate policy applied to the parking session
+ `type`: `VIS` (required, string) - The eligibility type applied to the parking session
+ Body
[
{
"parkingSessionId":"de9bd239-44f3-483e-9fd4-7c98567da200",
"locationId":"5594",
"vehicle":{
"id":1234,
"licensePlate":"ABC123",
"jurisdiction":"BC",
"countryCode":"CA",
"type":"motorcycle"
},
"startTime":"2015-09-01T16:16:00.000Z",
"stall":"82445",
"rateOption":{
"ratePolicyId":"5594",
"type":"VIS"
}
}
]
## Start parking [/parking/accounts/{accountId}/sessions]
### Start a new parking session[POST]
**Possible Response Codes**
- 202 - Accepted
- 400 - Bad Request
- 401 - Unauthorized
- 403 - Forbidden
**Possible Validation Errors**
- ParkingAccountIdInvalidFormat
- LocationNotFound
- CvvMustNotBeEmpty
- CvvInvalidFormat
- LicensePlateMustNotBeEmpty
- LicensePlateInvalidFormat
- DurationInvalidFormat
- JsonReaderException
**Possible events**
- ParkingSessionCreated
{
"ParkingSessionId": "23fccd39-70c2-446f-915c-6d2362b64e58",
"VehicleId": "12793707",
"LocationId": "64123",
"VehiclePlate": "GGG328",
"Stall": "",
"vehicleType": "car",
"StartTime": "2015-01-28T20:54:00-0000",
"ExpireTime": "2015-01-28T21:54:00-0000",
"$type": "ParkingSessionCreated"
}
- StartParkingFailed
{
"Data": [ ],
"FailureReason":"VehicleAlreadyParked",
"$type":"StartParkingFailed"
}
+ Parameters
+ accountId: `1b98d239-8de8-4111-9d7d-562fc31c193a` (required, string) - Parking account id.
+ Request
+ Attributes (application/json)
+ `locationId`:`70000` (required, string) - The lot ID of the location where the user wants to park
+ `stall`:`1` (required, string) - The stall number of the location where the user wants to park
+ `licensePlate`:`ABC123` (required, string) - The license plate of the vehicle that is parked
+ `duration`: (required, duration) - The duration of the parking session
+ `timeUnit`: `Minutes` (required, string) - TimeUnit Enumeration name or value. "Minutes", "Hours", "Days", "Weeks", "Months", "HalfHour", "MidnightCurrentDay", "CalendarDays", "TimeBucket", "SingleHour", "WeekdaysStartMonday", "CalendarWeeks", "NotSpecified", "Unknown"
+ `quantity`: `1` (required, string) - How many minutes or hours the user wants to park
+ `cvv`:`111` (required, string) - The CV2 code from the user's payment card
+ `startTime`:`2015-07-28T20:40:00-0000` (required, string) - The start time of the transaction to be started. Must be within 3 minutes of the current time.
+ `ratePolicyId`:`70000` (required, string) - The rate policy Id for a personalized parking session.
+ Body
[
{
"locationId":"70000",
"stall":"1",
"licensePlate":"ABC123",
"duration":{
"timeUnit":"Hours",
"quantity":"1"
},
"cvv":"111",
"startTime": "2015-07-28T20:40:00-0000",
"ratePolicyId":"70000"
}
]
+ Response 202
+ Headers
Location: https://api.paybyphone.com/events/workflow/d92cfe7d-dd59-49d6-be1a-a3b3bb5d3e6a
### Extend an existing parking session [PUT /parking/accounts/{accountId}/sessions/{activeParkingSessionId}]
**Possible Response Codes**
- 202 - Accepted
- 400 - Bad Request
- 401 - Unauthorized
**Possible Validation Errors**
- ParkingAccountIdInvalidFormat
- ActiveParkingSessionIsInvalid
- LocationNotFound
- CvvMustNotBeEmpty
- CvvInvalidFormat
- DurationInvalidFormat
- JsonReaderException
**Possible events**
- ParkingSessionExtended
{
"ParkingSessionId": "23fccd39-70c2-446f-915c-6d2362b64e58",
"VehicleId": "12793707",
"LocationId": "64123",
"VehiclePlate": "GGG328",
"Stall": "",
"vehicleType": "car",
"OldExpiryTime": "2015-01-28T20:54:00-0000",
"NewExpiryTime": "2015-01-28T21:54:00-0000",
"$type": "ParkingSessionExtended"
}
- ExtendParkingFailed
{
"Data": [ ],
"FailureReason":"PaymentDeclinedByGateway",
"$type":"ExtendParkingFailed"
}
+ Parameters
+ accountId: `1b98d239-8de8-4111-9d7d-562fc31c193a` (required, string) - Parking account id.
+ parkingSessionId: `2bf49b64-28cd-4fc7-96e4-a44b010bf6ea` (required, string) - The ID of the parking session to be extended, this must be an active session
+ Request
+ Attributes (application/json)
+ `duration`: (required, duration) - The duration of the parking session
+ `timeUnit`: `Minutes` (required, string) - TimeUnit Enumeration name or value. "Minutes", "Hours", "Days", "Weeks", "Months", "HalfHour", "MidnightCurrentDay", "CalendarDays", "TimeBucket", "SingleHour", "WeekdaysStartMonday", "CalendarWeeks", "NotSpecified", "Unknown"
+ `quantity`: `1` (required, string) - How many minutes or hours the user wants to park
+ `cvv`:`111` (required, string) - The CV2 code from the user's payment card
+ Headers
Authorization: Bearer <token>
+ Body
[
{
"parkingSessionId":"2bf49b64-28cd-4fc7-96e4-a44b010bf6ea",
"duration":{
"timeUnit":Hours",
"quantity":"1"
},
"cvv":"111"
}
]
+ Response 202
+ Headers
Location: https://api.paybyphone.com/events/workflow/d92cfe7d-dd59-49d6-be1a-a3b3bb5d3e6a
## Manage vehicles [/parking/accounts/{accountId}/vehicles]
### Get all vehicles belonging to a parking account [GET]
Get all vehicles from a User's Account.
**Possible Response Codes**
- 200 - Ok
- 401 - Unauthorized
- 403 - Forbidden
+ Request Contract
Header: Authorization: Bearer <token>
+ Response 200
[
{
"id":"14890",
"licensePlate":"TEST9233",
"province":"BC",
"country":"CA",
"vehicleType":"car"
},
{
"id":"14891",
"licensePlate":"TEST9233",
"province":"BC",
"country":"CA",
"vehicleType":"motorcycle"
}
]
### Add a vehicle to a parking account [POST]
**Possible Response Codes**
- 202 - Accepted
- 400 - Bad Request
- 401 - Unauthorized
- 403 - Forbidden
**Possible events**
- VehicleAdded
{
"parkingAccountId": "23fccd39-70c2-446f-915c-6d2362b64e28",
"vehicleId": "12793707",
"countryCode": "CA",
"licensePlate": "GGG328",
"jurisdiction": "MB",
"vehicleType": "car",
"$type": "VehicleAdded"
}
- AddVehicleFailed
{
"Data": [ {"jurisdiction": "BC"}, {"CountryId": "AU"} ],
"FailureReason":"jurisdictionDoesNotMatchCountry",
"$type":"AddVehicleFailed"
}
**Possible Validation Errors**
- LicensePlateInvalidFormat - License Plate is not a valid format. Minimum 2 characters, maximum 10 characters. A-Z and 0-9 characters only.
- LicensePlateMustNotBeEmpty - License Plate must not be empty.
- jurisdictionDoesNotExist - Jurisdiction does not exist. Valid jurisdictions are Countries and Regions supported by API#Provinces
- CountryCodeMustNotBeEmpty - Country Code must not be empty.
- CountryCodeDoesNotExist - Country Code does not exist. Valid country ids are: CA, US, GB, AU, FR, CH. See Countries and Regions supported by API#Countries
- VehicleTypeMustNotBeEmpty - VehicleType Vehicle Type must not be empty.
- VehicleTypeDoesNotExist - Vehicle Type does not exist. Valid types are: car, motorcycle, electricMotorcycle, heavyGoodsVehicle
- JsonReaderException - Provided json is in an invalid format
- JurisdictionDoesNotMatchCountry - Provided country does not contain provided jurisdiction.
+ Request
{
"licensePlate":"TEST9233",
"jurisdiction":"BC",
"countryCode":"CA",
"vehicleType":"car"
}
+ Response 202 (application/json)
+ Headers
Location: https://api.paybyphone.com/events/workflow/d92cfe7d-dd59-49d6-be1a-a3b3bb5d3e6a
## Manage a vehicle belonging to a parking account [/parking/accounts/{accountId}/vehicles/{vehicleId}]
### Update a vehicle on a parking account [PUT]
**Possible Response Codes**
- 403 - Forbidden
**Possible events**
- VehicleUpdated
{
"parkingAccountId": "23fccd39-70c2-446f-915c-6d2362b64e28",
"vehicleId": "12793707",
"countryCode": "CA",
"licensePlate": "GGG328",
"jurisdiction": "MB",
"vehicleType": "motorcycle",
"$type": "VehicleUpdated"
}
- UpdateVehicleFailed
{
"Data": [ {"jurisdiction": "BC"}, {"CountryId": "AU"} ],
"FailureReason":"JurisdictionDoesNotMatchCountry",
"$type":"AddVehicleFailed"
}
**Validation Errors**
- VehicleNotFound - Vehicle with vehicle Id not found.
- LicensePlateInvalidFormat - License Plate is not a valid format. Minimum 2 characters, maximum 10 characters. A-Z and 0-9 characters only.
- LicensePlateMustNotBeEmpty - License Plate must not be empty.
- JurisdictionDoesNotExist - Jurisdiction does not exist. Valid jurisdictions are Countries and Regions supported by API#Provinces
- CountryCodeMustNotBeEmpty - Country Code must not be empty.
- CountryCodeDoesNotExist - Country Code does not exist. Valid country ids are: CA, US, GB, AU, FR, CH. See Countries and Regions supported by API#Countries
- VehicleTypeMustNotBeEmpty - Vehicle Type must not be empty.
- VehicleTypeDoesNotExist - Vehicle Type does not exist. Valid types are: car, motorcycle, electricMotorcycle, heavyGoodsVehicle
- VehicleIdInvalidFormat - Vehicle Id must be an integer.
- UserNotRegistered - Member not registered.
- JsonReaderException - Provided json is in an invalid format.
+ Request
Body:
{
"licensePlate":"TEST9233",
"jurisdiction":"BC",
"countryCode":"CA",
"vehicleType":"car"
}
+ Response 202 (application/json)
+ Headers
Location: https://api.paybyphone.com/events/workflow/d92cfe7d-dd59-49d6-be1a-a3b3bb5d3e6a
### Delete a vehicle [DELETE]
Delete a vehicle from a parking account
**Possible Response Codes**
- 202 - Accepted
- 401 - Unauthorized
- 403 - Forbidden
**Possible events**
- VehicleDeleted
{
"parkingAccountId": "23fccd39-70c2-446f-915c-6d2362b64e28",
"vehicleId": "12793707",
"LegacyMemberUid": "18789426",
"$type": "VehicleDeleted"
}
- DeleteVehicleFailed
{
"Data": [ ],
"FailureReason":"UserNotRegistered",
"$type":"DeleteVehicleFailed"
}
**Validation Errors**
- VehicleNotFound - Vehicle with vehicle Id not found.
- JsonReaderException - Provided json is in an invalid format.
- UserNotRegistered - Member not registered.
- VehicleIdInvalidFormat - Vehicle Id must be an integer.
+ Response 202 (application/json)
+ Headers
Location: https://api.paybyphone.com/events/workflow/d92cfe7d-dd59-49d6-be1a-a3b3bb5d3e6a
## Get parking preferences for the parking account [GET /parking/accounts/{accountId}/preferences]
**Possible Response Codes**
- 200 - OK
- 400 - Bad Request
- 401 - Unauthorized
- 403 - Forbidden
**Possible Error Codes**
- EmailInvalidFormat
- JsonReaderException
+ Parameters
+ accountId: `00000000-0000-0000-0000-000000000000` (required, string) - Parking account id.
+ Response 200
+ Attributes (application/json)
+ `parkingAccountId`:`00000000-0000-0000-0000-000000000000` (string) - The parking account ID
+ `sendEmailReceipts`:`false` (string) - Does account holder wishes to get receipts from email
+ `sendTextReminders`:`false` (string) - Does account holder wishes to receive text reminder
+ `sendTextReceipts`:`false` (string) - Does account holder wishes to get receipts from text
+ `email`:`null` (string) - Email account for account holder
+ Body
{
"parkingAccountId":"00000000-0000-0000-0000-000000000000",
"sendEmailReceipts":false,
"sendTextReminders":false,
"sendTextReceipts":false,
"email":null
}
## Set parking preferences for the parking account [PUT /parking/accounts/{accountId}/preferences or POST /parking/accounts/{accountId}/preferences]
**Response Codes**
- 202 - OK
- 400 - Bad Request
- 401 - Unauthorized
- 403 - Forbidden
**Possible events**
- PreferencesCreated/PreferencesUpdated
{
"parkingAccountId": "23fccd39-70c2-446f-915c-6d2362b64e28",
"Email": "test@server.com",
"SendTextReceipts": "true",
"SendTextReminders": "true",
"SendEmailReceipts": "true",
"$type": "PreferencesCreated"
}
- AddMemberPreferencesFailed or UpdateMemberPreferencesFailed
{
"FailureReason":"UserNotRegistered",
"$type":"AddMemberPreferencesFailed"
}
+ Request (application/json)
+ Body
{
"email":"email@-domain.com",
"sendEmailReceipts":true,
"sendTextReceipts":true,
"sendTextReminders":true
}
+ Response 202 (application/json)
+ Headers
Location: https://api.paybyphone.com/events/workflow/d92cfe7d-dd59-49d6-be1a-a3b3bb5d3e6a
## Get or Create a parking account [/parking/accounts]
### Create a parking account for the member [POST]
**Response Codes**
- 202 - OK
- 401 - Unauthorized
**Possible events**
- ParkingAccountCreated
{
"ParkingAccountId":"23fccd39-70c2-446f-915c-6d2362b64e28",
"MemberId":"23fccd39-70c2-446f-915c-6d2362b64e58",
"$type":"ParkingAccountCreated"
}
- CreateParkingAccountFailed
{
"Data": [ ],
"FailureReason":"UserNotRegistered",
"$type":"CreateParkingAccountFailed"
}
+ Response 202 (application/json)
+ Headers
Location: https://api.paybyphone.com/events/workflow/d92cfe7d-dd59-49d6-be1a-a3b3bb5d3e6a
### Get all parking accounts for the member [GET]
**Response Codes**
- 200 - OK
- 401 - Unauthorized
+ Response 200 (application/json)
[
{
"id": "d6d1817e-98ee-4600-b82b-f1aace2abea5"
}
]
## Get a parking quote [/parking/accounts/{parkingAccountGuid}/quote?locationId={locationId}&timeUnit={TimeUnit}&quantity={Quantity}&licensePlate={LicensePlate}&stall={stall}&isExtend={isExtend}&ratePolicyId={ratePolicyId}]
### Retrieve a parking quote detail [GET]
Retrieve a parking quote detail
**Response Codes**
- 200 - Ok.
- 400 - Bad Bad request.
**Responsee Failure Reasons**
- LocationInvalidFormat - LocationId could not be converted to an integer format.
- TimeUnitInvalidFormat - Time unit is not in the accepted time units enumeration.
- Value is not valid for Quantity - Error thrown when the quantity parameter could not be converted to an integer format.
- QuantityInvalidFormat - Quantity can not be zero.
- LicensePlateMustNotBeEmpty - When getting a quote in a location that has a wait-time-after-max-stay restriction, you need to provide the license plate. This is to enforce the wait-time-after-max-stay restriction.
- CannotExtendBecauseOfNoReturnRule - When getting a quote in a location that has a wait-time-after-max-stay restriction, if you parked for the maximum stay you will need to wait until you can start parking again in
that location.
- RatePolicyIdInvalidFormat - LocationId could not be converted to an integer format.
- RatePolicyNotFound - Rate Policy Id specified is not associated with the location or the license plate.
+ Parameters
+ parkingAccountGuid: `b12e8e08-ee59-4774-8062-a40401272436` (required, guid) - GUID of the user parking account.
+ locationId: `40002` (required, string) - Location ID. Note that this can not be a reverse lookup stall, such as in the location details endpoint
+ timeUnit: `Minutes` (required, string) - Time unit enumeration string, as described in Time Units table below. Either the name or the value.
+ 1 (string) - Minutes
+ 2 (string) - Hours
+ 3 (string) - Days
+ 4 (string) - Weeks
+ 5 (string) - Months
+ 6 (string) - HalfHour
+ 7 (string) - MidnightCurrentDay
+ 8 (string) - CalendarDays
+ 9 (string) - TimeBucket
+ 10 (string) - SingleHour
+ 11 (string) - WeekdaysStartMonday
+ 12 (string) - CalendarWeeks
+ 0 (string) - NotSpecified/Unknown
+ Minutes (string)
+ Hours (string)
+ Days (string)
+ Weeks (string)
+ Months (string)
+ HalfHour (string)
+ MidnightCurrentDay (string)
+ CalendarDays (string)
+ TimeBucket (string)
+ SingleHour (string)
+ WeekdaysStartMonday (string)
+ CalendarWeeks (string)
+ NotSpecified (string)
+ Unknown (string)
+ quantity: `60` (required, int) - Number of time units.
+ licensePlate: `273cvn` (optional, string) - License plate being parked. Used to calculate promotion discounts.
+ stall: `52444` (optional, string) - Stall number of the current parking session. Used for extensions to ensure the app is extending the right session.
+ isExtend: `True` (optional, boolean) - True or False, resembling a boolean to indicate whether requesting the quote for an extension of a current parking session.
+ ratePolicyId: `75001` (optional, int) - The ID of the rate policy you want to use
+ Response
+ Attributes
+ locationId: `40006` (int) - The Location ID where the user is parked.
+ stall: `123` (string) - Stall where the vehicle is parked if the parking session took place in a stall, null otherwise.
+ quoteDate: `2015-06-25T18:00:00-0000` (dateTime) - Quote Time of the rate calculation, in UTC
+ totalCost: (money) - Total cost of the parkfig session
+ amount
+ currency
+ parkingAccountId: `56514ff5-44fc-463b-820f-1d47393e1703` (guid)
+ parkingStartTime: `2014-12-29T22:00:00-0000` (dateTime) - Parking Start Time of the rate calculation, in UTC
+ parkingExpiryTime: `2014-12-29T23:00:00-0000` (dateTime) - Parking Expiry Time of the rate calculation, in UTC
+ parkingDurationAdjustment: `NotAdjusted` (enum)
+ NotAdjusted
+ DurationIncreased
+ DurationDecreased
+ licensePlate: `ABC123` (string) - The license plate of the vehicle that is parked
+ quoteItems : (array[string])
+ quoteItemType
+ promotion
+ name
+ costAmount
+ amount
+ currency
+ Response 200 (application/json)
Content-Type: application/json
{
"locationId": "40006",
"stall": "123",
"quoteDate":"2015-06-25T18:00:00-0000",
"totalCost": {
"amount": 5.00,
"currency": "CAD"
},
"parkingAccountId": "56514ff5-44fc-463b-820f-1d47393e1703",
"parkingStartTime": "2014-12-29T22:00:00-0000",
"parkingExpiryTime": "2014-12-29T23:00:00-0000",
"patrkingDurationAdjustment": "NotAdjusted",
"licensePlate": "ABC123",
"quoteItems":[{
"quoteItemType":"parking",
"name": "Parking",
"costAmout":{
"amount":9.00,
"currency":"CAD"
}
},{
"quoteItemType":"convenienceFee",
"name": "Convenience Fee",
"costAmount": {
"amount": 1.00,
"currency": "CAD"
}
},{
"quoteItemType":"promotion",
"name": "COV electric vehicle discount.",
"costAmount": {
"amount": -5.00,
"currency": "CAD"
}
}]
}
## Get details parking rates [/parking/locations/{locationId}/ratePolicies?plates={list of license plates}]
### Get details about what rate policies can be applied at a location to the user's vehicles [GET]
**Response Failure Reasons**
-LocationInvalidFormat - LocationId could not be converted to an integer format.
+ Request
Header: Authorization: Bearer <token>
+ Parameters
+ plates: `ABC123` (required, string) - License plates to get the rate policies for (different vehicles may be eligible for different parking rates).
+ Response 200 (application/json)
Content-Type: application/json
[
{
"ratePolicyId": 75001,
"name": "Visiteur",
"eligibilityType": "VIS",
"isDefault": true,
"eligiblePlates": [
{
"plate": "ABC123",
"eligibleSectors": [
"1E"
]
}
]
}
]
## Parking location search [/parking/locations/?advertisedLocationNumber={advertisedLocationNumber}&countryCode={countryCode}&stall={stall}]
### Find zero or more locations' details [GET]
**Response codes**
- 200 - OK
- 400 - Bad Request
- 404 - Not Found
- 500 - Internal Server Error
**Max Stays Remarks and Examples**
- MaxStayCouldNotBeVerified - The maximum stay could not be accurately determined. The app should not show any message regarding max stay at the parking step, before the user enters duration.
- NoMaxStay - The location does not have a max stay. User can park for any duration. The app should not show any message regarding max stay at the parking step, before the user enters duration.
- ParkingAllowed currentMaxStayInSeconds: 7200 - User can only park for 7200 seconds. The app is safe to show a message regarding this limit.
- ParkingAllowed currentMaxStayInSeconds: 0 - Even though parking is allowed, we could not accurately determine the exact maximum allowed duration. The app should not show any message regarding max stay at the parking step, before the user enters duration.
- ParkingNotAllowed - Parking is not allowed at the time of calling this endpoint. The app is safe to show a "no parking at this time" message.
+ Request
Header: Authorization: Bearer <token>
+ Parameters
+ advertisedLocationNumber: `10` (required, string) - Can either be a Lot ID or a Stall, if the location supports reverse lookup.
+ countryCode: `CA` (optional, string) - Country ISO 3166 code of the location.