NanoPost

Simple social network designed for learning
Common Types & Objects
200 ResultResponse
Body
Object
result
boolean required
Default:
true
ProfileCompact
Object
id
string required
username
string required
displayName
string nullable
avatarUrl
string nullable
subscribed
boolean required
Paging
PagedDataResponse
Object
count
integer required
total
integer required
offset
string nullable
items
Array required
Проверка имени пользователя
GET /api/auth/checkUsername

Authentication

Open

Request parameters

username
string required

Имя пользователя, используемое для авторизации

Min length: 3
Max length: 16
Pattern: \w(?!.*?\.{2})[\w.]{1,14}\w
Example:
evo

Responses

200 OK
Body
Object
result
string required
Enumeration:
TooShort

имя пользователя короче 3 символов

TooLong

имя пользователя длиннее 16 символов

InvalidCharacters

имя пользователя содержит неподдерживаемые символы (разрешены a-z,_, .)

Taken

имя пользователя занято

Free

имя пользователя свободно

Аутентификация пользователя
GET /api/auth/login

Authentication

Open

Request parameters

username
string required

Имя пользователя, используемое для авторизации

Min length: 3
Max length: 16
Pattern: \w(?!.*?\.{2})[\w.]{1,14}\w
Example:
evo
password
string required

Пароль для учётной записи пользователя

Min length: 8
Example:
********

Responses

200 TokenResponse
Регистрация пользователя
POST /api/auth/register

Authentication

Open

Request body

Object
username
string required

Имя поьзователя, используемое для авторизации

Min length: 3
Max length: 16
Pattern: \w(?!.*?\.{2})[\w.]{1,14}\w
Example:
evo
password
string required

Пароль для учётной записи пользователя

Min length: 8
Example:
********

Responses

200 TokenResponse
200 TokenResponse
Body
Object
token
string required
userId
string required
Images
GET /api/v1/images/{profileId}
GET /api/v1/image/{imageId}
DELETE /api/v1/image/{imageId}
Получить картинки профиля
GET /api/v1/images/{profileId}

Authentication

Open

Path variables

profileId
string required
Examples:
evo4ceb5d23-6db1-4298-b766-705af2927b0f

Request parameters

count
integer optional
Default:
30
offset
string optional

Responses

200 OK
Body
Object
count
integer required
total
integer required
offset
string nullable
items
Array of Image required
Загрузить картинку
PUT /api/v1/image

Authentication

Bearer

Request body

multipart/form-data
Object
image
string binary required

Responses

200 OK
Body
Получить картинку
GET /api/v1/image/{imageId}

Authentication

Open

Path variables

imageId
string required

Responses

200 OK
Body
Удалить картинку
DELETE /api/v1/image/{imageId}

Authentication

Bearer

Path variables

imageId
string required

Responses

200 ResultResponse
Image
Object
id
string required
owner
ProfileCompact required
dateCreated
integer required

Время создания картинки в миллисекундах (long)

sizes
Array of ImageSize required
ImageSize
Object
width
integer required
height
integer required
url
string required
Profiles
GET /api/v1/profile/search
GET /api/v1/profile/{profileId}
PATCH /api/v1/profile/{profileId}
PUT /api/v1/profile/{profileId}/subscribe
DELETE /api/v1/profile/{profileId}/subscribe
PUT /api/v1/profile/pushToken
DELETE /api/v1/profile/pushToken
Найти профили
GET /api/v1/profile/search

Authentication

Open

Request parameters

query
string required

Поисковый запрос

count
integer optional
Default:
30
offset
string optional

Responses

200 OK
Body
Object
count
integer required
total
integer required
offset
string nullable
items
Array of ProfileCompact required
Получить профиль
GET /api/v1/profile/{profileId}

Authentication

Open

Path variables

profileId
string optional
Examples:
evo4ceb5d23-6db1-4298-b766-705af2927b0f

Responses

200 OK
Body
Редактировать профиль
PATCH /api/v1/profile/{profileId}

Authentication

Bearer

Path variables

profileId
string optional
Examples:
evo4ceb5d23-6db1-4298-b766-705af2927b0f

Request body

multipart/form-data
Object
displayName
string nullable
bio
string nullable
avatar
string binary nullable

Responses

200 ResultResponse
Подписаться на профиль
PUT /api/v1/profile/{profileId}/subscribe

Authentication

Bearer

Path variables

profileId
string required

Responses

200 ResultResponse
Отписаться от профиля
DELETE /api/v1/profile/{profileId}/subscribe

Authentication

Bearer

Path variables

profileId
string required

Responses

200 ResultResponse
Установить push-токен
PUT /api/v1/profile/pushToken

Authentication

Bearer

Request body

Object
pushToken
string required

Responses

200 ResultResponse
Удалить push-токен
DELETE /api/v1/profile/pushToken

Authentication

Bearer

Responses

200 ResultResponse
Profile
Object
id
string required
username
string required
displayName
string nullable
bio
string nullable
avatarId
string nullable
avatarSmall
string nullable
avatarLarge
string nullable
subscribed
boolean required
subscribersCount
integer required
postsCount
integer required
imagesCount
integer required
images
Array of Image required
Max items: 4
Posts
GET /api/v1/posts/{profileId}
PUT /api/v1/post
GET /api/v1/post/{postId}
DELETE /api/v1/post/{postId}
Получить ленту новостей
GET /api/v1/feed

Authentication

Bearer

Request parameters

count
integer optional
Default:
30
offset
string optional

Responses

200 OK
Body
Object
count
integer required
total
integer required
offset
string nullable
items
Array of Post required
Получить посты профиля
GET /api/v1/posts/{profileId}

Authentication

Open

Path variables

profileId
string optional
Examples:
evo4ceb5d23-6db1-4298-b766-705af2927b0f

Request parameters

count
integer optional
Default:
30
offset
string optional

Responses

200 OK
Body
Object
count
integer required
total
integer required
offset
string nullable
items
Array of Post required
Создать пост
PUT /api/v1/post

Authentication

Bearer

Request body

multipart/form-data
Object
text
string nullable
image1
string binary nullable
image2
string binary nullable
image3
string binary nullable
image4
string binary nullable

Responses

200 OK
Body
Получить пост
GET /api/v1/post/{postId}

Authentication

Open

Path variables

postId
string required

Responses

200 OK
Body
Удалить пост
DELETE /api/v1/post/{postId}

Authentication

Bearer

Path variables

postId
string required

Responses

200 ResultResponse
Post
Object
id
string required
owner
ProfileCompact required
dateCreated
integer required

Время создания поста в миллисекундах (long)

text
string nullable
images
Array of Image required
likes
Object required
liked
boolean required
likesCount
integer required