Authorization is performed by the AccessToken
in Authorization
header. Access token issues for 30 minutes, and refreshs by RefreshToken
in cookies. RefreshToken issues for 30 days. On logout refresh token adds to blacklist, and access token will never updated with this refresh token.
Field | Type | Description |
---|---|---|
id | string | The ID of user |
username | string | The username of user |
string | The email of user | |
telegram_id | sstring | ID of assigned telegram account |
Field | Type | Description |
---|---|---|
id | string | The ID of url |
alias | string | The short alias of url |
url | string | The original url |
redirects | int | The redirects counter |
Field | Type | Description |
---|---|---|
access_token | string | The access token |
refresh_token | string | The refresh token |
Body:
Field | Type | Required |
---|---|---|
string | Yes | |
password | string | Yes |
Success response: 200 OK
and token pair object.
Possible errors:
Code | Description |
---|---|
400 | Bad request. Missing required fields. User with this credentials already exists. |
Success response: 200 OK
Possible errors:
Code | Description |
---|---|
401 | Unauthorized |
Body:
Field | Type | Required |
---|---|---|
string | Yes | |
username | string | Yes |
password | string | Yes |
Success response: 201 Created
and user object.
Possible errors:
Code | Description |
---|---|
400 | Bad request. Missing required fields |
409 | User with this email or username already exists |
Body:
Field | Type | Required |
---|---|---|
token | string | Yes |
Success response: 200 OK
and token pair object.
Field | Type |
---|---|
access_token | string |
refresh_token | string |
Possible errors:
Code | Description |
---|---|
403 | Invalid refresh token |
Success response: 200 OK
and user object.
Possible errors:
Code | Description |
---|---|
404 | User not found |
Success response: 200 OK
Possible errors:
Code | Description |
---|---|
400 | Bad request. User not found in database |
401 | Unauthorized |
Success response: 200 OK
and array of url objects.
Possible errors:
Code | Description |
---|---|
401 | Unauthorized |
Request body:
Field | Type | Required |
---|---|---|
url | string | Yes |
alias | string | No |
Success response: 201 Created
and url object.
Possible errors:
Code | Description |
---|---|
400 | Bad request. Missing required fields |
401 | Unauthorized |
409 | URL with this alias already exists |
Request body:
Field | Type | Required |
---|---|---|
url | string | Yes |
alias | string | No |
Success response: 200 OK
and url object with not-updated fields.
Success response: 200 OK
Possible errors:
Code | Description |
---|---|
401 | Unauthorized |
403 | Forbidden. You are not owner of this URL |
404 | URL to delete not found |