REST API v2.8

Product Images & Files

Associate images and files with products.

Get Product Images

Endpoint

GET sites/{siteid}/products/{productid}/images

Parameters

start

The index of the item to start from

num

The number of items returned

fields

Comma separated list of fields to return. Use this to query only the fields you are using. Default is all fields in resource.

HTTP Response Status

200

OK. Returns data (see below).

400

Bad Request. Invalid syntax, missing required argument or invalid request.

401

Unauthorized. Authorization failed.

404

Resource not found. The url is invalid.

429

Too Many Requests.

500

Internal Server Error.

Returns

Returns an envelope with items of type resource for a product.

Example

Request

GET https://api.mysitoo.com/v2/accounts/1500/sites/1/products/14/images.json?num=2

Response

{ "totalcount": 3, "items": [ { "resourceid": "product1_1.jpg", "mimetype": "image\/jpeg", "width": 441, "height": 290, "filesize": 17635, "datecreated": 1352898291 }, { "resourceid": "product1_2.jpg", "mimetype": "image\/jpeg", "width": 441, "height": 290, "filesize": 33197, "datecreated": 1352898291 } ] }

Add Product Image

The only field that can be set is the resourceid. Optionally you can add an image using the field filedata which needs to be a base64-encoded string.

Endpoint

POST sites/{siteid}/products/{productid}/images

Request body

See resource for fields.
Required fields:
resourceid

HTTP Response Status

200

OK. Returns data (see below).

400

Bad Request. Invalid syntax, missing required argument or invalid request.

401

Unauthorized. Authorization failed.

404

Resource not found. The url is invalid.

429

Too Many Requests.

500

Internal Server Error.

Returns

Returns true if successful.

Example

Request

POST https://api.mysitoo.com/v2/accounts/1500/sites/1/products/14/images.json { "resourceid": "message.gif", "filedata": "R0lGODlhHwAJAPABAAAAAP\/\/\/yH5BAAAAAAALAAAAAAfAAkAAAItjI+pi3AOYgyuJTnp07ZvU1WaCF5mSWFpRnIfJ0Lni8Jbi8\/hrWJQr2IIh4gCADs=" }

Response

true

Get Product Image

The imageid is the index of the image among this product's images.

Endpoint

GET sites/{siteid}/products/{productid}/images/{imageid}

HTTP Response Status

200

OK. Returns data (see below).

400

Bad Request. Invalid syntax, missing required argument or invalid request.

401

Unauthorized. Authorization failed.

404

Resource not found. The url is invalid.

429

Too Many Requests.

500

Internal Server Error.

Returns

Returns an item of type resource.

Example

Request

GET https://api.mysitoo.com/v2/accounts/1500/sites/1/products/14/images/1.json

Response

{ "resourceid": "product1_2.jpg", "mimetype": "image\/jpeg", "width": 441, "height": 290, "filesize": 33197, "datecreated": 1352898291 }

Delete Product Image

Note that only the link between the product and the image is removed. Not the image itself.
The imageid is the index of the image in the product's image list.

Endpoint

DELETE sites/{siteid}/products/{productid}/images/{imageid}

HTTP Response Status

200

OK. Returns data (see below).

400

Bad Request. Invalid syntax, missing required argument or invalid request.

401

Unauthorized. Authorization failed.

404

Resource not found. The url is invalid.

429

Too Many Requests.

500

Internal Server Error.

Returns

Returns true if successful.

Example

Request

DELETE https://api.mysitoo.com/v2/accounts/1500/sites/1/products/14/images/1.json

Response

true

Get Product Files

A file is typically an associated .pdf-file or similar.

Endpoint

GET sites/{siteid}/products/{productid}/files

Parameters

start

The index of the item to start from

num

The number of items returned

fields

Comma separated list of fields to return. Use this to query only the fields you are using. Default is all fields in resource.

HTTP Response Status

200

OK. Returns data (see below).

400

Bad Request. Invalid syntax, missing required argument or invalid request.

401

Unauthorized. Authorization failed.

404

Resource not found. The url is invalid.

429

Too Many Requests.

500

Internal Server Error.

Returns

Returns an envelope with items of type resource for a product.

Example

Request

GET https://api.mysitoo.com/v2/accounts/1500/sites/1/products/14/files.json?num=2

Response

{ "totalcount": 1, "items": [ { "resourceid": "ProductSheet.pdf", "mimetype": "application\/pdf", "filesize": 160948, "datecreated": 1352898291 } ] }

Add Product File

The only field that can be set is the resourceid. Optionally you can add a file using the field filedata which needs to be a base64-encoded string.

Endpoint

POST sites/{siteid}/products/{productid}/files

Request body

See resource for fields.
Required fields:
resourceid

HTTP Response Status

200

OK. Returns data (see below).

400

Bad Request. Invalid syntax, missing required argument or invalid request.

401

Unauthorized. Authorization failed.

404

Resource not found. The url is invalid.

429

Too Many Requests.

500

Internal Server Error.

Returns

Returns true if successful.

Example

Request

POST https://api.mysitoo.com/v2/accounts/1500/sites/1/products/14/files.json { "resourceid": "message.txt", "filedata": "SGVsbG8gV29ybGQh" }

Response

true

Get Product File

The fileid is the index of the file in the product's file list.

Endpoint

GET sites/{siteid}/products/{productid}/files/{fileid}

HTTP Response Status

200

OK. Returns data (see below).

400

Bad Request. Invalid syntax, missing required argument or invalid request.

401

Unauthorized. Authorization failed.

404

Resource not found. The url is invalid.

429

Too Many Requests.

500

Internal Server Error.

Returns

Returns an item of type resource.

Example

Request

GET https://api.mysitoo.com/v2/accounts/1500/sites/1/products/14/files/1.json

Response

{ "resourceid": "message.txt", "mimetype": "text\/plain", "filesize": 12, "datecreated": 1543832750 }

Delete Product File

Note that only the link between the product and the file is removed. Not the file itself.
The fileid is the index of the file in the product's file list.

Endpoint

DELETE sites/{siteid}/products/{productid}/files/{fileid}

HTTP Response Status

200

OK. Returns data (see below).

400

Bad Request. Invalid syntax, missing required argument or invalid request.

401

Unauthorized. Authorization failed.

404

Resource not found. The url is invalid.

429

Too Many Requests.

500

Internal Server Error.

Returns

Returns true if successful.

Example

Request

DELETE https://api.mysitoo.com/v2/accounts/1500/sites/1/products/14/files/1.json

Response

true