Shop REST Service Documentation - version 4.3.0-4.4.3

Access current version of this documentation

Preamble

The Shop REST Service is available since easySDI v4.3.0 ; it integrates pricing data (since the pricing is on).
The service exposes two methods:
  • getOrders
  • setProduct

This methods are only availlable thru POST method in "multipart/form-data" when inputs are given.
The getOrders, if called without any parameter, can be accessed thru GET method.

Authentication

The authentication is done via the HTTP Basic Authentication header.

HTTP methods

getOrders without restrictions (all new products/diffusions) can be called by GET or POST method.

getOrders with parameters and setProduct have to use POST method.

When using POST, the data has to be sent using Content-Type: application/x-www-form-urlencoded

Fields are:
  • "xml" for all XML inputs (optionnal for getOrders, mandatory for setProduct)
  • "file" for binary data file (not used for getOrders, mandatory for setProduct using local storage)

Method getOrders

URL: /index.php?option=com_easysdi_shop&task=extract.getOrders

The getOrders method is designed to perform three kind of search:
  • unrestricted search (default)
  • search restricted by product's guids
  • search restricted by product's ids

For each kind of search, a restriction by product's state can be added (default to state 'SENT').

Inputs

XSD
The 'xml' input is optional ; then, search is unrestricted.
If present, it must validate the xsd : http://www.easysdi.org/2011/sdi/getordersparameters.xsd
Thus, parameters are:

  • unrestricted search:
    • states: an array of states ids - optionnal

  • search restricted by guids:
    • states: an array of states ids - optionnal
    • guids: an array of product's guids - mandatory
  • search restricted by ids:
    • states: an array of states ids - optionnal
    • ids: an array of product's ids - mandatory

Sample

Outputs

XSD
The getOrders output validate the xsd: http://www.easysdi.org/2011/sdi/getorders.xsd

Sample
The following sample is a resultset of two orders : the first one without pricing data, the second with.

Method setProduct

URL: /index.php?option=com_easysdi_shop&task=extract.setProduct

Inputs

XSD
The 'xml' input is mandatory, it must validate the xsd: http://www.easysdi.org/2011/sdi/setproductparameters.xsd

Extra
In case of a local storage, you have to send the extraction file side of the xml.
The file input name is 'file' and must contain the binary's content of the file.

Sample

Outputs

XSD
The setProduct output validate the xsd: http://www.easysdi.org/2011/sdi/setproduct.xsd

Sample

Exception

Status Explanation

Both methods could fall into an error for various reasons ; here is the explanation for each one:

Code Message Details Explanation
200 OK
400 Bad Request The given XML is not valid. Please consult the XSD : <xsd_url> The XSD cannot validate the 'xml' input
401 Unauthorized The authentication failed
403 Forbidden You cannot update this product You can't update a product you don't own
409 Conflict The product you are trying to update has already been updated
Couple product/order integrity violation The requested product is not part of the requested order
Unit size not recognized Note: should never fall in this cases with xsd validation
Product state not recognized
Product storage not recognized
500 Internal Server Error Cannot load the XML The XML cannot be loaded for internal reason : contact the easySDI Platform administrator
Cannot load the requested product The product cannot be retrieved in the db
Cannot load the requested order The order cannot be retrieved in the db
Cannot load the requested pricing product The pricing data for the ordered product cannot be retrieved in the db
Cannot load the requested pricing supplier The pricing data for the ordered product's supplier cannot be retrieve in the db
Cannot create the required folder The order response folder configured in the Shop component is missing and cannot be created
Cannot save uploaded file
Cannot update order diffusion The ordered product cannot be updated
Cannot update pricing order supplier product The pricing data for the ordered product cannot be updated
Cannot update pricing order supplier The pricing data for the ordered product's supplier cannot be updated
Cannot update pricing order The order pricing data cannot be updated
(mixed) Error while validating an XML against an XSD or saving an uploaded file

Sample