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 |
__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 |
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." } |
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 |
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()
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." } |
DEFAULT_PAGE_ITEMS
var |
---|
DEFAULT_CONTROLLER_NAME
var |
---|
DEFAULT_RATE_LIMIT
var |
---|
DEFAULT_RATE_RESET_PERIOD
var |
---|