Class ProductImagesApiV2Controller
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:
- http://shop.de/api.php/v2/product_images
or
- http://shop.de/api.php/v2/ProductImages
Using "productimages" as a resource name will not resolve to this controller.
-
AbstractApiV2Controller
-
HttpApiV2Controller
-
AbstractImagesApiV2Controller
-
ProductImagesApiV2Controller
Methods summary
protected
|
#
__initialize( )
Initializes API Controller
Initializes API Controller
|
protected
string
|
#
_getImageFolderName( )
Returns the absolute path where the image files are located.
Returns the absolute path where the image files are located.
Returns
string
|
public
|
#
post( )
Api
{post} /product_images Upload Product Image
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.
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."
}
Apigroup
Products
Apiname
UploadProductImage
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"
}
Apiversion
2.1.0
|
public
|
#
put( )
Api
{put} /product_images Rename Image File
Apidescription
Use this method to rename an existing image file.
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."
}
Apiexample
{json} Request-Body
{
"oldFilename": "my-old-image.png",
"newFilename": "my-new-image.png"
}
Apigroup
Products
Apiname
RenameImageFile
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"
}
Apiversion
2.1.0
|
public
|
#
delete( )
Api
{delete} /product_images Delete Product Image
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.
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."
}
Apiexample
{json} Delete Image
{
"filename": "file-to-be-deleted.png"
}
Apigroup
Products
Apiname
DeleteProductImage
Apisuccessexample
{json} Success-Response
{
"code": 200,
"status": "success",
"action": "delete",
"filename": "file-to-be-deleted.png"
}
Apiversion
2.1.0
|
public
|
#
get( )
Api
{get} /product_images Get Product Images
Apidescription
Get a list of all product image files which exists in the server's filesystem through a GET request.
Apiexample
{curl} Get All Product Images
curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/product_images
Apigroup
Products
Apiname
GetProductImages
Apiversion
2.1.0
Overrides
|