From 7300004358f25073d5d8dc9c3090130b1a1d85ff Mon Sep 17 00:00:00 2001 From: Patryk Dolata Date: Wed, 9 Dec 2020 21:41:32 +0100 Subject: [PATCH] --- REST-API.md | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 1 deletion(-) diff --git a/REST-API.md b/REST-API.md index a363d76..6a44e82 100644 --- a/REST-API.md +++ b/REST-API.md @@ -1 +1,107 @@ -Witaj na wiki! \ No newline at end of file +# **Welcome on the SmartPicasso REST API wiki!** +Here you can find available endpoints in our REST app. + + +## Authentication +Authentication is performing with JWT token. You must add `Bearer ` to the `Authorization` header if endpoint requires auth. + + + +## POST /api/authenticate +Endpoint using to authenticate user during signing in +* **requires authentication**: + + `False` +* **uri**: + + `/api/authenticate` +* **request body**: + + { + "email": "example@test.com", + "password": "pass" + } +* **success response example**: + + `status_code: 200` + + { + "success": "True", + "status_code": 200, + "message": "User logged in successfully", + "token": "token" + } +* **error response example**: + + `status_code: 400` + + { + "non_field_errors": [ + "An user with provided email and password is not found" + ] + } + +## POST /api/register +Endpoint using to register new user +* **requires authentication**: + + `False` +* **uri**: + + `/api/register` +* **request body**: + + { + "email": "example@test.com", + "password": "pass", + "profile": { + "username": "j.doe", + "first_name": "John", + "last_name": "Doe" + } + } +* **success response example**: + + `status_code: 201` + + { + "success": "True", + "status_code": 201, + "message": "User registered successfully" + } +* **error response examples**: + + `status_code: 400` + + { + "email": [ + "user with this email address already exists." + ] + } + + + or + + + { + "profile": { + "username": [ + "user profile with this username already exists." + ] + } + } + + or + + { + "email": [ + "user with this email address already exists." + ], + "profile": { + "username": [ + "user profile with this username already exists." + ] + } + } + +