-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiary.apib
165 lines (111 loc) · 3.2 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
version: v1
uri_prefix: /api/v1
# Starter
Lumen starter app is a bootstrap of a microservice api or to scale as a backend for any client.
# User [/user]
## Get the an example [GET /user]
To get an example response
+ Request (application/json)
+ Headers
Authorization: Token ApiKey123
+ Response 200 (application/json)
{
"status": 200,
"message": "Successfully fetched user data"
}
+ Request (application/json)
+ Headers
Authorization: Token WrongApiKey
+ Response 401 (application/json)
{
"status": 401,
"message": "Invalid API Key"
}
## Add a new trip [POST /user]
Adds a new user to the db.
+ Request (application/json)
+ Headers
Authorization: Token ApiKey123
+ Body
{
"first_name": "Sam",
"last_name": "Son",
"number": "27848118111",
"status": "enabled"
}
+ Response 200 (application/json)
{
"status": 200,
"message": "User added successfully",
"data": {
"user": {
"id": "1"
},
"links": [
{
"rel": "next",
"uri": "/api/v1/user/1"
}
]
}
}
+ Request (application/json)
+ Headers
Authorization: Token WrongApiKey
+ Body
{
"first_name": "Sam",
"last_name": "Son",
"number": "27848118111",
"status": "enabled"
}
+ Response 401 (application/json)
{
"status": 401,
"message": "Invalid API Key"
}
+ Request (application/json)
+ Headers
Authorization: Token ApiKey123
+ Body
{
"last_name": "Son",
"number": "27848118111",
"status": "enabled"
}
+ Response 400 (application/json)
{
"status": 400,
"message": "Missing required field first_name"
}
+ Request (application/json)
+ Headers
Authorization: Token ApiKey123
+ Body
{
"number": "27848118111",
"status": "enabled"
}
+ Response 400 (application/json)
{
"status": 400,
"message": "Missing required field first_name, last_name"
}
+ Request (application/json)
+ Headers
Authorization: Token ApiKey123
+ Body
{
"first_name": "Sam",
"last_name": "Son",
"status": "enabled"
"number": "someBadNumber"
}
+ Response 406 (application/json)
{
"status": 406,
"message": "This number is not valid for the <REGION> region.",
"data": {
"required_format": "<required format for country>"
}
}