ProductImagesApiV2Controller

Extends \AbstractImagesApiV2Controller

Class ProductImagesApiV2Controller

Provides an API interface for managing product images through the ProductWriteService.

Notice: This controller IS NOT a sub-resource of the ProductsApiV2Controller.

This controller can be reached by using one of the following URIs:

or

Using "productimages" as a resource name will not resolve to this controller.

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

DeleteProductImage

apiGroup

Products

apiDescription

Remove the product image file from the server. This method will always provide a successful response even if the image file was not found.

apiExample

{json} Delete Image { "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 This operation requires a JSON object with "filename" properties set.

apiErrorExample

Error-Response HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "This operation requires a JSON object with "filename" properties set. Check the documentation on how to properly use the API." }

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

UploadProductImage

apiGroup

Products

apiDescription

Uploads an image file for the products. 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.

apiErrorExample

Error-Response HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "No image file was provided." }

put

put() 
api
apiVersion

2.1.0

apiName

RenameImageFile

apiGroup

Products

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 This operation requires a JSON object with "oldFilename" and "newFilename" properties set.

apiErrorExample

Error-Response HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "This operation requires a JSON object with "oldFilename" and "newFilename" properties set. Check the documentation on how to properly use the API." }

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