POST /users
Body parameters:
name: string
username: string
email: string
password: string
Response:
{
"id": 10
}
GET /users/:userId
Path parameters:
userId - id of the user
Response:
{
"id": 10,
"name": "Clark Kent",
"username": "superman",
"email": "clark.kent@dailyplanet.com",
"avatar": "d1d99db3ac32052b9dd66cb5914508dd",
"bio": "Kryptonian hero",
"likes": 2,
"images": 10,
"created": "2017-11-15T10:05:28Z"
}
PUT /users/:userId
Path parameters:
userId - id of the user
Body parameters:
name: string (optional)
username: string (optional)
email: string (optional)
password: string (optional)
oldPassword: string (optional, required if password is present)
avatar: string (optional)
bio: string (optional)
GET /users/:userId/images
Path parameters:
userId - id of the user
Response:
{
"items": [
{
"id": 12,
"userId": 10,
"filename": "d1d99db3ac32052b9dd66cb5914508dd",
"description": "Image description",
"likes": 2,
"liked": true,
"created": "2017-11-15T16:58:49Z"
}
]
}
GET /users/:userId/likes
Path parameters:
userId - id of the user
Response:
{
"items": [
{
"id": 12,
"userId": 10,
"filename": "d1d99db3ac32052b9dd66cb5914508dd",
"description": "Image description",
"likes": 2,
"liked": true,
"created": "2017-11-15T16:58:49Z"
}
]
}
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 /images
Body parameters:
filename: string
description: string
Response:
{
"id": 12
}
GET /images
Response:
{
"items": [
{
"id": 12,
"userId": 10,
"filename": "6710497b36573655ed145f1bc1e01052",
"description": "Some image description",
"likes": 3,
"liked": false,
"created": "2017-11-13T14:57:19Z"
}
]
}
GET /users/:userId/images
Response:
{
"items": [
{
"id": 12,
"userId": 10,
"filename": "6710497b36573655ed145f1bc1e01052",
"description": "Some image description",
"likes": 3,
"liked": false,
"created": "2017-11-13T14:57:19Z"
}
]
}
GET /users/:userId/likes
Response:
{
"items": [
{
"id": 12,
"userId": 10,
"filename": "6710497b36573655ed145f1bc1e01052",
"description": "Some image description",
"likes": 3,
"liked": false,
"created": "2017-11-13T14:57:19Z"
}
]
}
GET /images/:imageId
Path parameters:
imageId - id of the image
Response:
{
"id": 12,
"userId": 10,
"filename": "6710497b36573655ed145f1bc1e01052",
"description": "Some image description",
"likes": 3,
"liked": false,
"created": "2017-11-13T14:57:19Z"
}
DELETE /images/:imageId
Path parameters:
imageId - id of the image
POST /images/:imageId/likes
Path parameters:
imageId - id of the image
DELETE /images/:imageId/likes
Path parameters:
imageId - id of the image
An image asset has to be uploaded before creating an Image object.
The returned image name is used for the filename
parameter.
File size should be less than 1MB.
POST /uploads
Body parameters:
image: file sent as multipart/form-data
Response:
{
"filename": "d4aab3fd72517522479c08520bc150a3"
}
GET /uploads/:filename
Path parameters:
filename - filename returned from the upload function
Response:
The image data