A Go API made for studies that manages tasks with user authentication
POST /register (registers new user)
name type data type required string (valid email) password required string
http code content-type response 201application/json{"ok":"use /login to authenticate"}400application/json{"description":"Validation error","error":"Key: 'User.Email' Error:Field validation for 'Email' failed on the 'email' tag"}400application/json{"description":"Validation error","error":"Key: 'UserDTO.Email' Error:Field validation for 'Email' failed on the 'required' tag"}400application/json{"description":"Validation error","error":"Key: 'UserDTO.Password' Error:Field validation for 'Password' failed on the 'required' tag"}
POST /login (logs in user)
name type data type required string password required string
http code content-type response 200application/json{"token":"..."}400application/json{"description":"Validation error","error":"Key: 'UserDTO.Email' Error:Field validation for 'Email' failed on the 'required' tag"}400application/json{"description":"Validation error","error":"Key: 'UserDTO.Password' Error:Field validation for 'Password' failed on the 'required' tag"}400application/json{"description":"Validation error","error":"crypto/bcrypt: hashedPassword is not the hash of the given password"}500application/json{"description":"Repository error","error":"User not found"}
PATCH /user (updates user's properties)
name type data type optional string password optional string
name data type Authorization string (JWT token)
| http code | content-type | response | | --------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------- | --- | --- | |
200|application/json|{"status":"success"}| |400|application/json|{"description":"Validation error","error":"Key: 'User.Email' Error:Field validation for 'Email' failed on the 'email' tag"}| | | |401|application/json|{"description":"You must be authenticated","error":"token is malformed: ..."}| | | |401|application/json|{"description":"You must be authenticated","error":"Authorization header not found"}| | | |401|application/json|{"description":"You must be authenticated","error":"token has invalid claims: token is expired"}| | |
DELETE /user (deletes user)
name data type Authorization string (JWT token)
| http code | content-type | response | | --------- | ------------------ | -------------------------------------------------------------------------------------------------- | --- | --- | |
200|application/json|{"status":"success"}| |401|application/json|{"description":"You must be authenticated","error":"token is malformed: ..."}| | | |401|application/json|{"description":"You must be authenticated","error":"Authorization header not found"}| | | |401|application/json|{"description":"You must be authenticated","error":"token has invalid claims: token is expired"}| | |
GET /tasks (gets all authenticated user's tasks)
name data type Authorization string (JWT token)
| http code | content-type | response | | --------- | ------------------ | -------------------------------------------------------------------------------------------------- | --- | --- | |
200|application/json|[{...}]| |401|application/json|{"description":"You must be authenticated","error":"token is malformed: ..."}| | | |401|application/json|{"description":"You must be authenticated","error":"Authorization header not found"}| | | |401|application/json|{"description":"You must be authenticated","error":"token has invalid claims: token is expired"}| | |
GET /tasks/:id (gets a task in authenticated user's tasks)
name data type Authorization string (JWT token)
| http code | content-type | response | | --------- | ------------------ | -------------------------------------------------------------------------------------------------- | --- | --- | |
200|application/json|{...} | || |400|application/json|{"description":"Validation error","error":"invalid UUID length: ..."}| | | |401|application/json|{"description":"You must be authenticated","error":"token is malformed: ..."}| | | |401|application/json|{"description":"You must be authenticated","error":"Authorization header not found"}| | | |401|application/json|{"description":"You must be authenticated","error":"token has invalid claims: token is expired"}| | | |500|application/json|{"description":"Repository error","error":"Task not found"}|
POST /tasks (creates a task in authenticated user's tasks list)
name type data type title required string description optional string toDate required string (dd/mm/yy hh:mm) tags optional []string
name data type Authorization string (JWT token)
| http code | content-type | response | | --------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | --- | --- | |
201|application/json|{"createdTaskId":"..."}| |400|application/json|{"description":"Validation error","error":"Key: 'CreateTaskDTO.Title' Error:Field validation for 'Title' failed on the 'required' tag"}| | | |400|application/json|{"description":"Validation error","error":"Key: 'CreateTaskDTO.ToDate' Error:Field validation for 'ToDate' failed on the 'required' tag"}| | | |400|application/json|{"description":"Validation error","error":"parsing time..."}| | | |401|application/json|{"description":"You must be authenticated","error":"token is malformed: ..."}| | | |401|application/json|{"description":"You must be authenticated","error":"Authorization header not found"}| | | |401|application/json|{"description":"You must be authenticated","error":"token has invalid claims: token is expired"}| | |
PATCH /tasks/:id (updates a task in authenticated user's tasks list)
name type data type title optional string description optional string toDate optional string (dd/mm/yy hh:mm) completed optional bool tags optional []string
name data type Authorization string (JWT token)
| http code | content-type | response | | --------- | ------------------ | -------------------------------------------------------------------------------------------------- | --- | --- | |
200|application/json|{"status":"success"}| |400|application/json|{"description":"Validation error","error":"parsing time..."}| | | |400|application/json|{"description":"Validation error","error":"invalid UUID length: ..."}| | | |401|application/json|{"description":"You must be authenticated","error":"token is malformed: ..."}| | | |401|application/json|{"description":"You must be authenticated","error":"Authorization header not found"}| | | |401|application/json|{"description":"You must be authenticated","error":"token has invalid claims: token is expired"}| | | |500|application/json|{"description":"Repository error","error":"Task not found"}|
DELETE /tasks/:id (deletes a task in authenticated user's tasks list)
name data type Authorization string (JWT token)
| http code | content-type | response | | --------- | ------------------ | -------------------------------------------------------------------------------------------------- | --- | --- | |
200|application/json|{"status":"success"}| |400|application/json|{"description":"Validation error","error":"parsing time..."}| | | |400|application/json|{"description":"Validation error","error":"invalid UUID length: ..."}| | | |401|application/json|{"description":"You must be authenticated","error":"token is malformed: ..."}| | | |401|application/json|{"description":"You must be authenticated","error":"Authorization header not found"}| | | |401|application/json|{"description":"You must be authenticated","error":"token has invalid claims: token is expired"}| | | |500|application/json|{"description":"Repository error","error":"Task not found"}|