POST /users
Body parameters:
name: string
username: string
email: string
password: string
Response:
{
"id": 10
}
PUT /users/:userId
Path parameters:
userId - id of the user
Body parameters:
name: string (optional)
username: string (optional)
email: string (optional)
password: string (optional)
old_password: string (optional, required if password is present)
bio: string (optional)
GET /users/:userId
Path parameters:
userId - id of the user
Response:
{
"id": 10,
"name": "Clark Kent",
"username": "superman",
"email": "clark.kent@dailyplanet.com",
"bio": "Kryptonian hero",
"posts": 3,
"likes": 1,
"following": 0,
"followers": 10,
"followed": false,
"created": "2017-11-15T10:05:28+00:00"
}
GET /users/:userId/following
Path parameters:
userId - id of the user
page - number of page with results
limit - results per request
Response:
{
"items": [
{
"id": 10,
"name": "Clark Kent",
"username": "superman",
"email": "clark.kent@dailyplanet.com",
"bio": "Kryptonian hero",
"posts": 3,
"likes": 1,
"following": 0,
"followers": 10,
"followed": false,
"created": "2017-11-15T10:05:28+00:00"
}
]
}
GET /users/:userId/followers
Path parameters:
userId - id of the user
page - number of page with results
limit - results per request
Response:
{
"items": [
{
"id": 10,
"name": "Clark Kent",
"username": "superman",
"email": "clark.kent@dailyplanet.com",
"bio": "Kryptonian hero",
"posts": 3,
"likes": 1,
"following": 0,
"followers": 10,
"followed": false,
"created": "2017-11-15T10:05:28+00:00"
}
]
}
POST /users/:userId/followers
Path parameters:
userId - id of the user
DELETE /users/:userId/followers
Path parameters:
userId - id of the user
Sets an session
cookie with the session id.
POST /sessions
Body parameters:
email: string
password: string
Response:
{
"id": 10
}
The active session is taken from the session
cookie.
DELETE /sessions
POST /posts
Body parameters:
content: string
Response:
{
"id": 12
}
GET /posts
Path parameters:
page - number of page with results
limit - results per request
Response:
{
"items": [
{
"id": 12,
"userId": 10,
"content": "Some post content",
"likes": 10,
"liked": true,
"reposts": 2,
"reposted": false,
"created": "2017-11-15T10:05:28+00:00"
}
]
}
GET /posts/:postId
Path parameters:
postId - id of the post
Response:
{
"id": 12,
"userId": 10,
"content": "Some post content",
"likes": 10,
"liked": true,
"reposts": 2,
"reposted": false,
"created": "2017-11-15T10:05:28+00:00"
}
DELETE /posts/:postId
Path parameters:
postId - id of the post
GET /users/:userId/posts
Path parameters:
userId - id of the user
page - number of page with results
limit - results per request
Response:
{
"items": [
{
"id": 12,
"userId": 10,
"content": "Some post content",
"likes": 10,
"liked": true,
"reposts": 2,
"reposted": false,
"created": "2017-11-15T10:05:28+00:00"
}
]
}
GET /users/:userId/likes
Path parameters:
userId - id of the user
page - number of page with results
limit - results per request
Response:
{
"items": [
{
"id": 12,
"userId": 10,
"content": "Some post content",
"likes": 10,
"liked": true,
"reposts": 2,
"reposted": false,
"created": "2017-11-15T10:05:28+00:00"
}
]
}
POST /posts/:postId/likes
Path parameters:
postId - id of the post
DELETE /posts/:postId/likes
Path parameters:
postId - id of the post
POST /posts/:postId/reposts
Path parameters:
postId - id of the post
DELETE /posts/:postId/reposts
Path parameters:
postId - id of the post