REST API v2.8

Vouchers

Collection of voucher. (Referred to as Campaigns in Sitoo Backoffice)

Get Vouchers

Endpoint

GET sites/{siteid}/vouchers

Parameters

start

The index of the item to start fromDefault: 0

num

The number of items returnedDefault: 10

fields

Comma separated list of fields to return. Use this to query only the fields you are using. See voucher for all fields. Default fields:
voucheridvouchernamedatecreatedvouchertypevoucherstate

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 voucher.

Example

Request

GET https://api.mysitoo.com/v2/accounts/1500/sites/1/vouchers.json?num=3

Response

{ "totalcount": 3, "items": [ { "voucherid": 1, "vouchername": "Spring Sale", "datecreated": 1462953900, "vouchertype": 110, "voucherstate": 10 }, { "voucherid": 2, "vouchername": "10% Off", "datecreated": 1462954020, "vouchertype": 210, "voucherstate": 10 }, { "voucherid": 3, "vouchername": "$10 Off", "datecreated": 1462954020, "vouchertype": 200, "voucherstate": 10 } ] }

Add Voucher

Endpoint

POST sites/{siteid}/vouchers

Request body

See voucher for fields.
Required fields:
vouchernamevouchertype

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 voucherid if successful.

Example

Request

POST https://api.mysitoo.com/v2/accounts/1500/sites/1/vouchers.json { "vouchertype": 200, "vouchername": "Resellers", "value_x": 30 }

Response

4

Get Voucher

Endpoint

GET sites/{siteid}/vouchers/{voucherid}

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 voucher.

Example

Request

GET https://api.mysitoo.com/v2/accounts/1500/sites/1/vouchers/4.json

Response

{ "voucherid": 4, "active": true, "activepos": true, "vouchercode": "", "voucherpassword": "", "vouchername": "Resellers", "vouchercomment": "", "voucherterms": "", "datecreated": 1543832752, "datestart": null, "dateend": null, "vouchertype": 200, "value_x": 30, "value_y": null, "value_z": null, "money_m": null, "money_n": null, "maxuses": null, "priority": 3, "vouchergrouptype": 20, "voucherstate": 10, "products": [], "productoptions": [] }

Update Voucher

Endpoint

PUT sites/{siteid}/vouchers/{voucherid}

Request body

See voucher for fields.

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

PUT https://api.mysitoo.com/v2/accounts/1500/sites/1/vouchers/4.json { "vouchername": "Voucher for Resellers" }

Response

true

Delete Voucher

Endpoint

DELETE sites/{siteid}/vouchers/{voucherid}

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/vouchers/4.json

Response

true