#%RAML 1.0 title: PROGRAMATOR.SK version: v1 baseUri: http://api.programator.sk/ mediaType: application/json /gallery: description: Working with galleries get: description: | 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`. responses: 200: body: application/json: type: !include schemas/gallery_list.json example: | { "galleries": [ { "path": "Wild%20Nature", "name": "Wild Nature" }, { "path": "Cars", "name": "Cars" } ] } 500: description: Unknown error post: description: | Create a new gallery. Gallery name cannot contain `/` char. body: application/json: type: !include schemas/gallery_insert.json example: | { "name": "Wild animals" } responses: 201: description: Gallery was created body: application/json: example: | { "path": "Animals", "name": "Animals" } 400: description: Invalid request. The request doesn't conform to the schema. body: application/json: description: Error detail. example: | { "code": 400, "payload": { "paths": ["name"], "validator": "required", "example": null }, "name": "INVALID_SCHEMA", "description": "Bad JSON object: u'name' is a required property" } 409: description: Gallery with this name already exists 500: description: Unknown error /{path}: get: description: List photos in the gallery. responses: 200: description: | List of photos in the gallery and information about the gallery. body: application/json: type: !include schemas/gallery_detail.json 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" } ] } 404: description: Gallery does not exists 500: description: Unknown error delete: description: Delete gallery or photo responses: 200: description: Gallery/photo was deleted 404: description: Gallery/photo does not exists 500: description: Unknown error post: description: Photo upload to a chosen gallery headers: Content-Type: type: string required: true example: | Content-Type: multipart/form-data; boundary=--boundary body: multipart/form-data: description: | Photo upload to a chosen gallery. It is possible to upload more than one photo. API will process every image/jpeg. A request is a standard file upload using `multipart/form-data` header. The filename will be used as a photo title. If a file already exists a number is appended to the filename. type: file fileTypes: ["image/jpeg"] example: | ----boundary Content-Disposition: form-data; name="image"; filename="elephant.jpg" Content-Type: image/jpeg ----boundary-- responses: 201: body: application/json: example: | {"uploaded": [{ "path": "elephant.jpg", "fullpath": "Animals/elephant.jpg", "name": "Elephant", "modified": "2017-04-19T08:11:00+0200" }]} 400: description: Invalid request - file not found. 404: description: Gallery not found /images: description: Working with photos /{w}x{h}/{path}: uriParameters: w: type: number description: | 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: type: number description: | 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: type: string description: | `fullpath` parameter from the list of photos `GET /gallery/{path}` get: description: Generate photo preview responses: 200: body: image/jpeg: 404: description: Photo not found 500: description: The photo preview can't be generated.