trucker-api (1.0.0)

Download OpenAPI specification:Download

Generic responses

Generic response may be returned to any request that is missing some required data. To not repeat the same piece of documentation everywhere generic responses will be omitted from examples and you should assume that when request is mailformed you may recieve generic response.

One or more required fields are missing

HTTP 400 Bad Request

{
  "{field}": ["This field is required."]
}

Required fields are marked with required beside field name

Authentication

bearerAuth

Authorization using JWT

Generic responses

Access token is invalid or expired

HTTP 401 Unauthorized

{
  "detail": "Given token not valid for any token type",
  "code": "token_not_valid"
  "message" {
    "token_class": "AccessToken"
    "token_type": "access"
    "message": "Token is invalid or expired"
  }
}

Access token is not provided

HTTP 401 Unauthorized

{
  "detail": "Authentication credentials were not provided"
}
Security Scheme Type HTTP
HTTP Authorization Scheme bearer
Bearer format "JWT"

Registration/Login

Register new user

Server converts all images in RGBA colorspace into RGB. It is recommended that this conversion is done on client side to decrease load on server and speed up request processing.

Image sizes are limited to 5MB

Request Body schema: application/json

Data of the user to register

phone
required
string

Phone number

password
required
string <password>

Password

email
required
string <email>

Email

first_name
required
string

First name

last_name
required
string

Last name

birthday
required
string <date>

Birthday

picture
required
binary

Profile picture

Responses

Request samples

Content type
application/json
{
  • "phone": "+123456789012",
  • "password": "pa$$word",
  • "email": "user@example.com",
  • "first_name": "first",
  • "last_name": "last",
  • "birthday": "1604574056",
  • "picture": null
}

Response samples

Content type
application/json
{
  • "refresh": "{refresh_token}",
  • "access": "{access_token}"
}

Login

Get access and refresh token for the given user

Request Body schema: application/json

Login credentials

username
required
string

Username

password
required
string <password>

Password

Responses

Request samples

Content type
application/json
{
  • "username": "username",
  • "password": "pa$$word"
}

Response samples

Content type
application/json
{
  • "refresh": "{refresh_token}",
  • "access": "{access_token}"
}

Facebook login

Given facebook access token log user in or register new user

Request Body schema: application/json

Access token

access
required
string

Access token

Responses

Request samples

Content type
application/json
{
  • "access": "{access_token}"
}

Response samples

Content type
application/json
{
  • "refresh": "{refresh_token}",
  • "access": "{access_token}"
}

Google login

Given google access token log user in or register new user

Request Body schema: application/json

Access token

access
required
string

Access token

Responses

Request samples

Content type
application/json
{
  • "access": "{access_token}"
}

Response samples

Content type
application/json
{
  • "refresh": "{refresh_token}",
  • "access": "{access_token}"
}

User profile

Get user profile for given user id

You can use "me" to get profile of the currently logged in user e.g.

GET /accounts/me
Authorizations:

Responses

Response samples

Content type
application/json
{
  • "id": "1",
  • "phone": "+123456789012",
  • "email": "user@example.com",
  • "first_name": "first",
  • "last_name": "last",
  • "birthday": "1604574056",
  • "picture": "http://example.com"
}

Token

Refresh access token

Request Body schema: application/json

Refresh token

refresh
required
string

Refresh token

Responses

Request samples

Content type
application/json
{
  • "refresh": "{refresh_token}"
}

Response samples

Content type
application/json
{
  • "refresh": "{refresh_token}",
  • "access": "{access_token}"
}