-
URL
/api/v1/user/register
-
Method:
POST
-
Data Params
{ "name": "string|required", "phone": "string|required", "role": "string|required|user,admin" }
-
Success Response:
- Code: 200
Content:{ "data": "string", "status": "success" }
- Code: 200
-
Error Response:
- Code: 400 BAD REQUEST
Content:{ "data": "string", "status": "error" }
OR
- Code: 500 INTERNAL SERVER ERROR
Content:{ "data": "string", "status": "error" }
- Code: 400 BAD REQUEST
-
Notes:
After successful register, user will obtain a password from the response which will be used for login.
-
URL
/api/v1/user/register
-
Method:
POST
-
Data Params
{ "phone": "string|required", "password": "string|required" }
-
Success Response:
- Code: 200
Content:{ "data": "string", "status": "success" }
- Code: 200
-
Error Response:
- Code: 400 BAD REQUEST
Content:{ "data": "string", "status": "error" }
OR
- Code: 500 INTERNAL SERVER ERROR
Content:{ "data": "string", "status": "error" }
- Code: 400 BAD REQUEST
-
Notes:
After successful login, user will receive token from the response.
-
URL
/api/v1/fetcher
-
Method:
GET
-
Request Header
Authorization: Bearer token
-
Success Response:
- Code: 200
Content:{ "data": "string", }
- Code: 200
-
Error Response:
- Code: 403 UNAUTHORIZED
Content:{ "data": "string", }
OR
- Code: 500 INTERNAL SERVER ERROR
Content:{ "data": "string", }
- Code: 403 UNAUTHORIZED
-
Notes:
On the first endpoint hit, it often takes time to request because this endpoint is make a request to external API, for the next request, redis will cache the external API data for 1 hour to make the request more responsive.
-
URL
/api/v1/admin/fetcher
-
Method:
GET
-
Request Header
Authorization: Bearer token
-
Success Response:
- Code: 200
Content:{ "data": "string" }
- Code: 200
-
Error Response:
- Code: 403 UNAUTHORIZED
Content:{ "data": "string", }
OR
- Code: 500 INTERNAL SERVER ERROR
Content:{ "data": "string", }
- Code: 403 UNAUTHORIZED
-
Notes:
This request is the same with normal request, the different is, this request is only for user with admin role.
An endpoint to verify JWT Token.
-
URL
/api/v1/jwt/verify
-
Method:
GET
-
Request Header
Authorization: Bearer token
-
Success Response:
- Code: 200
Content:{ "data": { "CreatedAt": "string", "Name": "string", "Phone": "string", "Role": "string", "exp": "number", "iss": "string" }, "status": "success" }
- Code: 200
-
Error Response:
- Code: 400 BAD REQUEST
Content:{ "data": "string", "status": "error" }
OR
- Code: 500 INTERNAL SERVER ERROR
Content:{ "data": "string", "status": "error" }
- Code: 400 BAD REQUEST