SamuraiJS Social Network API documentation version 1.1
https://social-network.samuraijs.com/api/1.1
Here you can get beta API documentation https://docs.google.com/document/d/1ZSXmTzkgq_Kj1VbWuq8fTv_DPD95GFDvPZgqFeIYGoM/edit#
SamuraiJS Social Network
This is a Social-Network Server API. You can find out more about this API at https://social-network.samuraijs.com/docs
/auth
Is current user authorized
get /auth/me
Is current user authorized
HTTP status code 200
successful operation
Headers
- Content-Type: required(application/json)
Body
Media type: application/json
Type: object
Properties- data: required(object)
if user is authenticated then data contains all this properties
- id: required(number)
logged user id
- email: required(string)
logged user email
- login: required(string)
user login
- id: required(number)
- resultCode: required(number)
(0 if opearation completed successfullt, other numbers - some error occured)
- messages: required(array of string)
is empty if resultCode is 0, contains error messages if resultCode is different from 0
Example:
{
resultCode: 0
messages: [],
data: {
id: 2,
email: 'blabla@bla.bla',
login: 'samurai'
}
}
Authorize on the service
Unfollow requested user
post /auth/login
Authorize on the service
Body
Media type: application/json
Type: object
Properties- email: required(string)
valid confirmed user email address, which used during registration
- password: required(string)
valid user password
- rememberMe: (boolean)
if true, then session will not be expired after session finishing
- captcha: (boolean)
text from captcha-image that should be added if there is resultCode is 10 in response data.
HTTP status code 200
successful operation
Headers
- Content-Type: required(application/json)
Body
Media type: application/json
Type: OperationResult
Properties- resultCode: required(string)
0 - OK, 1 - request is invalid, 10 - request is invalid and captcha is required
- messages: required(array of )
is empty if resultCode is 0, contains error messages if resultCode is different from 0
- data: required(object)
if user is authenticated then data contains all this properties
- userId: required(number)
logged user id
- userId: required(number)
Example:
{
resultCode: 0
messages: [],
data: {
userId: 2
}
}
delete /auth/login
Unfollow requested user
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- resultCode: required(number)
(0 if opearation completed successfullt, other numbers - some error occured)
- messages: required(array of string)
is empty if resultCode is 0, contains error messages if resultCode is different from 0
- data: required(object)
some additional data
Example:
{
resultCode: 1
messages: ['Something wrong'],
data: {}
}
/todo-lists
Get all todolists for authorized user
Create new todolist (max todolists count - 10)
get /todo-lists
Get all todolists for authorized user
HTTP status code 200
Body
Media type: application/json
Type: array of object
Items: Todolist
- id: required(string)
- addedDate: required(datetime)
- order: required(number)
- title: required(string)
Example:
[
{
"id": "9f27f97b-bc63-4114-9baa-c91facbd4ffb",
"title": "what todo",
"addedDate": "2019-07-30T12:24:15.063",
"order": 0
} ]
post /todo-lists
Create new todolist (max todolists count - 10)
Body
Media type: application/json
Type: object
Properties- title: required(string - maxLength: 100)
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- data: required(object)
some additional data
- item: required(object)
Created todolist entity
- id: required(string)
- addedDate: required(datetime)
- order: required(number)
- title: required(string)
Example:
{ "id": "a2dfe62b-ebce-4b37-9581-1cc77ebc999f", "title": "important", "addedDate": "2019-07-30T12:23:49.677", "order": 0 }
- item: required(object)
- resultCode: required(number)
(0 if opearation completed successfullt, other numbers - some error occured)
- messages: required(array of string)
is empty if resultCode is 0, contains error messages if resultCode is different from 0
Example:
{
resultCode: 0
messages: [],
data: {
item: {
"id": "a2dfe62b-ebce-4b37-9581-1cc77ebc999f",
"title": "important",
"addedDate": "2019-07-30T12:23:49.677",
"order": 0
}
}
}
Delete todolist
Update todolist title
delete /todo-lists/{todolistId}
Delete todolist
URI Parameters
- todolistId: required(string)
ID of target todolist that will be processed
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- resultCode: required(number)
(0 if opearation completed successfullt, other numbers - some error occured)
- messages: required(array of string)
is empty if resultCode is 0, contains error messages if resultCode is different from 0
- data: required(object)
some additional data
Example:
{
resultCode: 1
messages: ['Something wrong'],
data: {}
}
put /todo-lists/{todolistId}
Update todolist title
URI Parameters
- todolistId: required(string)
ID of target todolist that will be processed
Body
Media type: application/json
Type: object
Properties- title: required(string - maxLength: 100)
Change todolists order
put /todo-lists/{todolistId}/reorder
Change todolists order
URI Parameters
- todolistId: required(string)
ID of target todolist that will be processed
Body
Media type: application/json
Type: object
Properties- putAfterItemId: (string)
Target todolist will be order after this todolist. If value is null, then todolist will be move to the top of the list
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- resultCode: required(number)
(0 if opearation completed successfullt, other numbers - some error occured)
- messages: required(array of string)
is empty if resultCode is 0, contains error messages if resultCode is different from 0
- data: required(object)
some additional data
Example:
{
resultCode: 1
messages: ['Something wrong'],
data: {}
}
Get portion of tasks for todolist
Create new task for concrete todolist (max tasks count - 100)
get /todo-lists/{todolistId}/tasks
Get portion of tasks for todolist
URI Parameters
- todolistId: required(string)
ID of target todolist that will be processed
Query Parameters
- count: (integer - default: 10 - maximum: 100)
page size (how many items will be returned in response)
- page: (integer - default: 1)
number of portion of items
HTTP status code 200
successful operation
Headers
- Content-Type: required(application/json)
Body
Media type: application/json
Type: object
Properties- items: required(array of Task)
Items: Task
- description: required(string)
- title: required(string)
- completed: required(boolean)
- status: required(integer)
- priority: required(integer)
- startDate: required(datetime)
- deadline: required(datetime)
- id: required(string)
- todoListId: required(string)
- order: required(integer)
- addedDate: required(datetime)
- totalCount: (integer)
total amount of tasks for concrete todolist
- error: (string)
if result can't be returned this field will contain error message
post /todo-lists/{todolistId}/tasks
Create new task for concrete todolist (max tasks count - 100)
URI Parameters
- todolistId: required(string)
ID of target todolist that will be processed
Body
Media type: application/json
Type: object
Properties- title: required(string - maxLength: 100)
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- data: required(object)
some additional data
- item: required(object)
Created task entity
- description: required(string)
- title: required(string)
- completed: required(boolean)
- status: required(integer)
- priority: required(integer)
- startDate: required(datetime)
- deadline: required(datetime)
- id: required(string)
- todoListId: required(string)
- order: required(integer)
- addedDate: required(datetime)
- item: required(object)
- resultCode: required(number)
(0 if opearation completed successfullt, other numbers - some error occured)
- messages: required(array of string)
is empty if resultCode is 0, contains error messages if resultCode is different from 0
Example:
{
resultCode: 1
messages: ['Something wrong'],
data: {}
}
You should send the complete UpdateTaskModel object even if you update only one property
Delete task
put /todo-lists/{todolistId}/tasks/{taskId}
You should send the complete UpdateTaskModel object even if you update only one property
URI Parameters
- todolistId: required(string)
ID of target todolist that will be processed
- taskId: required(string)
ID of target task that will be processed
Body
Media type: application/json
Type: object
Properties- title: required(string)
- description: required(string)
- completed: required(boolean)
- status: required(integer)
- priority: required(integer)
- startDate: required(datetime)
- deadline: required(datetime)
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- data: required(object)
some additional data
- item: required(object)
Created task entity
- description: required(string)
- title: required(string)
- completed: required(boolean)
- status: required(integer)
- priority: required(integer)
- startDate: required(datetime)
- deadline: required(datetime)
- id: required(string)
- todoListId: required(string)
- order: required(integer)
- addedDate: required(datetime)
- item: required(object)
- resultCode: required(number)
(0 if opearation completed successfullt, other numbers - some error occured)
- messages: required(array of string)
is empty if resultCode is 0, contains error messages if resultCode is different from 0
Example:
{
resultCode: 1
messages: ['Something wrong'],
data: {}
}
delete /todo-lists/{todolistId}/tasks/{taskId}
Delete task
URI Parameters
- todolistId: required(string)
ID of target todolist that will be processed
- taskId: required(string)
ID of target task that will be processed
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- resultCode: required(number)
(0 if opearation completed successfullt, other numbers - some error occured)
- messages: required(array of string)
is empty if resultCode is 0, contains error messages if resultCode is different from 0
- data: required(object)
some additional data
Example:
{
resultCode: 1
messages: ['Something wrong'],
data: {}
}
Change tasks order
put /todo-lists/{todolistId}/tasks/{taskId}/reorder
Change tasks order
URI Parameters
- todolistId: required(string)
ID of target todolist that will be processed
- taskId: required(string)
ID of target task that will be processed
Body
Media type: application/json
Type: object
Properties- putAfterItemId: (string)
Target task will be moved after this task. If value is null, then task will be moved at the first position
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- resultCode: required(number)
(0 if opearation completed successfullt, other numbers - some error occured)
- messages: required(array of string)
is empty if resultCode is 0, contains error messages if resultCode is different from 0
- data: required(object)
some additional data
Example:
{
resultCode: 1
messages: ['Something wrong'],
data: {}
}