PROGRAMATOR.SK API documentation version v1
http://api.programator.sk/
/gallery
Working with galleries
List of all galleries. A response consists of an array of objects where a path
is the path that can be used to access gallery detail and name
is the gallery name.
If a gallery has a title photo, it can be accessed in image
.
Create a new gallery. Gallery name cannot contain /
char.
get /gallery
List of all galleries. A response consists of an array of objects where a path
is the path that can be used to access gallery detail and name
is the gallery name.
If a gallery has a title photo, it can be accessed in image
.
HTTP status code 200
Body
Media type: application/json
Type:
{
"title": "Gallery list schema",
"type": "object",
"properties": {
"galleries": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {"type": "string"},
"name": {"type": "string"},
"image": {
"type": "object",
"properties": {
"path": {"type": "string"},
"fullpath": {"type": "string"},
"name": {"type": "string"},
"modified": {"type": "string"}
},
"required": ["path", "fullpath", "name", "modified"]
}
},
"required": ["path", "name"]
}
}
},
"required": ["galleries"],
"additionalProperties": true
}
Example:
{
"galleries": [
{
"path": "Wild%20Nature",
"name": "Wild Nature"
},
{
"path": "Cars",
"name": "Cars"
}
]
}
HTTP status code 500
Unknown error
post /gallery
Create a new gallery. Gallery name cannot contain /
char.
Body
Media type: application/json
Type:
{
"title": "New gallery insert schema",
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1
}
},
"required": ["name"],
"additionalProperties": false
}
Example:
{
"name": "Wild animals"
}
HTTP status code 201
Gallery was created
Body
Media type: application/json
Type: any
Example:
{
"path": "Animals",
"name": "Animals"
}
HTTP status code 400
Invalid request. The request doesn't conform to the schema.
Body
Media type: application/json
Type: any
Example:
{
"code": 400,
"payload": {
"paths": ["name"],
"validator": "required",
"example": null
},
"name": "INVALID_SCHEMA",
"description": "Bad JSON object: u'name' is a required property"
}
HTTP status code 409
Gallery with this name already exists
HTTP status code 500
Unknown error
List photos in the gallery.
Delete gallery or photo
Photo upload to a chosen gallery
get /gallery/{path}
List photos in the gallery.
URI Parameters
- path: required(string)
HTTP status code 200
List of photos in the gallery and information about the gallery.
Body
Media type: application/json
Type:
{
"title": "Gallery detail schema",
"type": "object",
"properties": {
"gallery": {
"type": "object",
"properties": {
"path": {"type": "string"},
"name": {"type": "string"}
},
"required": ["path", "name"]
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {"type": "string"},
"fullpath": {"type": "string"},
"name": {"type": "string"},
"modified": {"type": "string"}
},
"required": ["path", "fullpath", "name", "modified"]
}
}
},
"required": ["gallery", "images"],
"additionalProperties": true
}
Example:
{
"gallery": {
"path": "Animals",
"name": "Animals"
},
"images": [
{
"path": "elephant.jpg",
"fullpath": "Animals/elephant.jpg",
"name": "Elephant",
"modified": "2017-04-19T08:11:00.0+0200"
},
{
"path": "lion.jpg",
"fullpath": "Animals/lion.jpg",
"name": "Lion",
"modified": "2017-04-19T08:11:32.0+0200"
}
]
}
HTTP status code 404
Gallery does not exists
HTTP status code 500
Unknown error
post /gallery/{path}
Photo upload to a chosen gallery
URI Parameters
- path: required(string)
Headers
- Content-Type: required(string)
Example:
Content-Type: multipart/form-data; boundary=--boundary
Body
Media type: multipart/form-data
Type: file
Example:
----boundary
Content-Disposition: form-data; name="image"; filename="elephant.jpg"
Content-Type: image/jpeg
<encoded document>
----boundary--
/images
Working with photos
Generate photo preview
get /images/{w}x{h}/{path}
Generate photo preview
URI Parameters
- w: required(number)
Requested width of a photo. Can be "0", in that case, the width is calculated from height maintaining the aspect ratio of the photo.
- h: required(number)
Requested height of a photo. Can be "0", in that case, the height is calculated from width maintaining the aspect ratio of the photo.
- path: required(string)
fullpath
parameter from the list of photosGET /gallery/{path}