-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIDA.apib
201 lines (146 loc) · 6.67 KB
/
IDA.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
# 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