Skip to content

Commit 920a324

Browse files
committed
Spec'd authentication endpoints
1 parent 9601447 commit 920a324

File tree

1 file changed

+72
-108
lines changed

1 file changed

+72
-108
lines changed

apiary.apib

Lines changed: 72 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -7,135 +7,99 @@ Snipe is an API backend for the Snipe Marketplace
77

88
## Authentication [/auth]
99

10-
### Register [GET]
10+
### Register [POST /auth/register]
1111

12-
+ Response 200 (application/json)
12+
+ Request (application/json)
1313

14-
[
15-
{
16-
"question": "Favourite programming language?",
17-
"published_at": "2015-08-05T08:40:51.620Z",
18-
"choices": [
19-
{
20-
"choice": "Swift",
21-
"votes": 2048
22-
}, {
23-
"choice": "Python",
24-
"votes": 1024
25-
}, {
26-
"choice": "Objective-C",
27-
"votes": 512
28-
}, {
29-
"choice": "Ruby",
30-
"votes": 256
31-
}
32-
]
14+
{
15+
"firstname": "John",
16+
"lastname": "Doe",
17+
"phonenumber": "+2348077788899",
18+
"email": "[email protected]",
19+
"password": "theSafePa$$w0rd$$555//"
20+
}
21+
22+
+ Response 200 (application/json)
23+
24+
{
25+
"status": "success",
26+
"data": {
27+
"firstname": "John",
28+
"lastname": "Doe",
29+
"phonenumber": "+2348077788899",
30+
"email": "[email protected]"
3331
}
34-
]
32+
}
3533

36-
### Forgot Password [GET]
34+
### Reset Password [POST /auth/resetpassword]
35+
36+
+ Request (application/json)
37+
38+
{
39+
"email": "[email protected]",
40+
"oldPassword": "theSafePa$$w0rd$$555//", // (optional)
41+
"password": "theSafePa$$w0rd$$555//",
42+
"confirmPassword": "theSafePa$$w0rd$$555//"
43+
}
3744

3845
+ Response 200 (application/json)
3946

40-
[
41-
{
42-
"question": "Favourite programming language?",
43-
"published_at": "2015-08-05T08:40:51.620Z",
44-
"choices": [
45-
{
46-
"choice": "Swift",
47-
"votes": 2048
48-
}, {
49-
"choice": "Python",
50-
"votes": 1024
51-
}, {
52-
"choice": "Objective-C",
53-
"votes": 512
54-
}, {
55-
"choice": "Ruby",
56-
"votes": 256
57-
}
58-
]
47+
{
48+
"status": "success",
49+
"data": {
50+
"message": "Verification email sent. or Password changed."
5951
}
60-
]
52+
}
6153

62-
### Sign In [GET]
54+
### Verify Password Reset [GET /auth/verifyresetpassword/:hash]
55+
Do html redirect to the password reset successful page
6356

64-
+ Response 200 (application/json)
57+
+ Parameters
58+
+ hash: "2d3343ae567c8f8a0b9e8f" (string, required) - verification hash from password reset verification email.
6559

66-
[
67-
{
68-
"question": "Favourite programming language?",
69-
"published_at": "2015-08-05T08:40:51.620Z",
70-
"choices": [
71-
{
72-
"choice": "Swift",
73-
"votes": 2048
74-
}, {
75-
"choice": "Python",
76-
"votes": 1024
77-
}, {
78-
"choice": "Objective-C",
79-
"votes": 512
80-
}, {
81-
"choice": "Ruby",
82-
"votes": 256
83-
}
84-
]
85-
}
86-
]
60+
+ Response 200 (text/html)
8761

88-
### Sign Out [GET]
62+
### Log In [POST]
63+
64+
+ Request (application/json)
65+
66+
{
67+
"email": "[email protected]",
68+
"password": "theSafePa$$w0rd$$555//",
69+
}
8970

9071
+ Response 200 (application/json)
9172

92-
[
93-
{
94-
"question": "Favourite programming language?",
95-
"published_at": "2015-08-05T08:40:51.620Z",
96-
"choices": [
97-
{
98-
"choice": "Swift",
99-
"votes": 2048
100-
}, {
101-
"choice": "Python",
102-
"votes": 1024
103-
}, {
104-
"choice": "Objective-C",
105-
"votes": 512
106-
}, {
107-
"choice": "Ruby",
108-
"votes": 256
109-
}
110-
]
73+
{
74+
"status": "success",
75+
"data": {
76+
"accessToken": "2d3343ae567c8f8a0b9e8f2d3343ae567c8f8a0b9e8f",
77+
"expiry": "3600",
78+
"refreshToken": "3d3343ae567c8f8a0b9e8f2d3343ae567c8f8a0b9e8f"
11179
}
112-
]
80+
}
81+
82+
### Log Out [GET /auth/logout]
83+
84+
+ Response 200 (text/html)
85+
+ Note: Do html redirect to the password reset successful page and kill the active access token and refresh tokens
11386

114-
### Deactivate [GET]
87+
### Deactivate [GET /auth/deactivate/:user_id]
88+
89+
+ Parameter
90+
+ user_id: "2d3343ae567c8f8a0b9e8f" (String, required) - The id of the user to be deactivated
91+
92+
+ Headers
93+
Authorization: dd3343ae567c8f8a0b9e8f // This token must be of an administrator or the user to be deactivated
11594

11695
+ Response 200 (application/json)
11796

118-
[
119-
{
120-
"question": "Favourite programming language?",
121-
"published_at": "2015-08-05T08:40:51.620Z",
122-
"choices": [
123-
{
124-
"choice": "Swift",
125-
"votes": 2048
126-
}, {
127-
"choice": "Python",
128-
"votes": 1024
129-
}, {
130-
"choice": "Objective-C",
131-
"votes": 512
132-
}, {
133-
"choice": "Ruby",
134-
"votes": 256
135-
}
136-
]
97+
{
98+
"status": "success",
99+
"data": {
100+
"message": "User deactivated."
137101
}
138-
]
102+
}
139103

140104
## User Management [/users]
141105

0 commit comments

Comments
 (0)