parent
b6b9531f60
commit
7300004358
108
REST-API.md
108
REST-API.md
@ -1 +1,107 @@
|
||||
Witaj na wiki!
|
||||
# **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 <token>` 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."
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user