Class CategoryImagesApiV2Controller
This controller handles the Category Image file operations. The clients of the API can list, upload, rename or delete files that exist in the server.
category |
System |
---|---|
package |
ApiV2Controllers |
__construct(\Slim\Slim $api, array $uri)
Call this constructor from every child controller class in order to set the Slim instance and the request routes arguments to the class.
deprecated |
The "__initialize" method will is deprecated and will be removed in a future version. Please use the new "init" for bootstrapping your child API controllers. |
---|---|
Throws |
|
\Slim\Slim
Slim framework instance, used for request/response manipulation.
array
This array contains all the segments of the current request, starting from the resource.
delete()
apiVersion |
2.1.0 |
---|---|
apiName |
DeleteCategoryImage |
apiGroup |
Categories |
apiDescription |
Removes the category image file from the server. This method will always provide a successful response even if the image file was not found. |
apiExample |
{json} Request-Body { "filename": "file-to-be-deleted.png" } |
apiSuccessExample |
{json} Success-Response { "code": 200, "status": "success", "action": "delete", "filename": "file-to-be-deleted.png" } |
apiError |
400-BadRequest The body of the request was empty or the request body did not contain the filename or its value was invalid. |
apiErrorExample |
Error-Response (Empty request body) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "Category image data were not provided." } Error-Response (Missing parameter) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "This operation requires a JSON object with 'filename' properties set." } |
get()
This function searches for image files ('gif', 'jpeg', 'jpg', 'png') in the path which is specified in the child classes _getImageFolderName method.
getCallableResource( $controller, array $mappedURI, \Slim\Slim $api)
array
\Slim\Slim
post()
apiVersion |
2.1.0 |
---|---|
apiName |
UploadCategoryImage |
apiGroup |
Categories |
apiDescription |
Uploads an icon image for the categories. Make this request without the "Content-Type: application/json". Except from the file the POST request must also contain a "filename" value with the final file name. |
apiSuccess |
(Success 201) Response-Body Contains information about the uploaded file. |
apiSuccessExample |
{json} Success-Response { "code": 201, "status": "success", "action": "upload", "filename": "my-image-file.png" } |
apiError |
400-BadRequest No image file was provided or the "filename" parameter was not provided. |
apiErrorExample |
Error-Response (Missing image file) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "No image file was provided." } Error-Response (Missing filename parameter) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "The 'filename' parameter is required and was not provided with the request." } |
put()
apiVersion |
2.1.0 |
---|---|
apiName |
RenameImageFile |
apiGroup |
Categories |
apiDescription |
Use this method to rename an existing image file. |
apiExample |
{json} Request-Body { "oldFilename": "my-old-image.png", "newFilename": "my-new-image.png" } |
apiSuccess |
Response-Body Contains information about the executed operation. |
apiSuccessExample |
{json} Response-Body { "code": 200, "status": "success", "action": "rename", "oldFilename": "my-old-image.png", "newFilename": "my-new-image.png" } |
apiError |
400-BadRequest The body of the request was empty or the request body did not contain the oldFilename or newFilename properties, or their values were invalid. |
apiErrorExample |
Error-Response (Empty request body) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "Category image data were not provided." } Error-Response (Missing parameters) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "This operation requires a JSON object with 'oldFilename' and 'newFilename' properties set." } |
DEFAULT_PAGE_ITEMS
var |
---|
DEFAULT_CONTROLLER_NAME
var |
---|
DEFAULT_RATE_LIMIT
var |
---|
DEFAULT_RATE_RESET_PERIOD
var |
---|