CategoryImagesApiV2Controller

Extends \AbstractImagesApiV2Controller

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

Methods

AbstractApiV2Controller Constructor

__construct(\Slim\Slim $api, array $uri) 
inherited

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
\HttpApiV2Exception

Through _validateRequest

Arguments

$api

\Slim\Slim

Slim framework instance, used for request/response manipulation.

$uri

array

This array contains all the segments of the current request, starting from the resource.

delete

delete() 
api
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." }

Returns a list of all image files which exists on the server's filesystem.

get() 
inherited

This function searches for image files ('gif', 'jpeg', 'jpg', 'png') in the path which is specified in the child classes _getImageFolderName method.

getCallableResource

getCallableResource( $controller, array $mappedURI, \Slim\Slim $api) 
inherited static

Arguments

$controller

$mappedURI

array

$api

\Slim\Slim

post

post() 
api
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

put() 
api
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." }

Constants

Defines the default page offset for responses that return multiple items.

DEFAULT_PAGE_ITEMS
inherited
var

Default controller to be loaded when no resource was selected.

DEFAULT_CONTROLLER_NAME
inherited
var

Defines the maximum request limit for an authorized client.

DEFAULT_RATE_LIMIT
inherited
var

Defines the duration of an API session in minutes.

DEFAULT_RATE_RESET_PERIOD
inherited
var

Properties