Categories

Operations with pictures

Operations with Pictures - INSERT, DELETE

Get all pictures from your store
GET /odata/picture

Request Type: GET

Enter the request URL: http://StoreURL/odata/picture

Auth type: Bearer Token - paste the token generated in the previous steps

GET all products

Get picture by ID
GET /odata/picture('id')

Request Type: GET

Enter the request URL: http://StoreURL/odata/picture('id')

Auth type: Bearer Token - paste the token generated in the previous steps

As a result, you will get your picture.

How to add picture to store
POST /odata/picture

Request Type: POST

Enter the request URL: http://StoreURL/odata/picture

Auth type: Bearer Token - paste the token generated in the previous steps

Headers: In the Key field enter the Content-Type, in Value field enter the application/json, description is empty.

Body: In the body field you need to enter the proper JSON. Which fields are necessary for specified actions you can check in the bottom of $metadata page, section with EntityAction. This method requires more actions from you. 

You need to know the MIME Type, list of MIME types can be found here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types

If you want to insert picture, you need to have BASE64 code of image. You can convert your picture here: https://www.base64-image.de/

{
"PictureBinary":"Base64 code of picture",
"MimeType":"mime type of image",
"SeoFilename":"leave empty",
"AltAttribute":"Enter alt of the picture",
"TitleAttribute":"Enter title of the picture",
"IsNew":"True/False",
"id":"must be empty",
}

As a result you will get status 201 and full content of body request, what's important for you, in the response you will receive ID of picture, which is required in another methods, i.e CreateProductPicture:

Added picture via API

How to delete picture from store
DELETE /odata/picture('id')

Request Type: DELETE

Enter the request URL: http://StoreURL/odata/picture('id')

Auth type: Bearer Token - paste the token generated in the previous steps

Please note that in DELETE operations, you will get only "Status: 200 OK" information if the item was successfully deleted.

back to top