@@ -7,135 +7,99 @@ Snipe is an API backend for the Snipe Marketplace
7
7
8
8
## Authentication [/auth]
9
9
10
- ### Register [GET ]
10
+ ### Register [POST /auth/register]
11
11
12
- + Response 200 (application/json)
12
+ + Request (application/json)
13
13
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
+
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
+
33
31
}
34
- ]
32
+ }
35
33
36
- ### Forgot Password [GET ]
34
+ ### Reset Password [POST /auth/resetpassword]
35
+
36
+ + Request (application/json)
37
+
38
+ {
39
+
40
+ "oldPassword": "theSafePa$$w0rd$$555//", // (optional)
41
+ "password": "theSafePa$$w0rd$$555//",
42
+ "confirmPassword": "theSafePa$$w0rd$$555//"
43
+ }
37
44
38
45
+ Response 200 (application/json)
39
46
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."
59
51
}
60
- ]
52
+ }
61
53
62
- ### Sign In [GET ]
54
+ ### Verify Password Reset [GET /auth/verifyresetpassword/:hash]
55
+ Do html redirect to the password reset successful page
63
56
64
- + Response 200 (application/json)
57
+ + Parameters
58
+ + hash: "2d3343ae567c8f8a0b9e8f" (string , required ) - verification hash from password reset verification email.
65
59
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)
87
61
88
- ### Sign Out [GET ]
62
+ ### Log In [POST ]
63
+
64
+ + Request (application/json)
65
+
66
+ {
67
+
68
+ "password": "theSafePa$$w0rd$$555//",
69
+ }
89
70
90
71
+ Response 200 (application/json)
91
72
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"
111
79
}
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
113
86
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
115
94
116
95
+ Response 200 (application/json)
117
96
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."
137
101
}
138
- ]
102
+ }
139
103
140
104
## User Management [/users]
141
105
0 commit comments