silvershop-core
silvershop-core copied to clipboard
Web Service API
Turning the module into a webservice could help make it more modular and customisable. It should help to abstract away the interface from the underlying system logic.
Taking this approach could also allow:
- Full javascript front-ends using frameworks such as backbone
- Mobile / tablet apps
Creating a web service API will not only open stores to be manipulated in a variety of ways, but also will help drive the project towards a solution that is scalable, and well modularised. This is the proposal for version 1 of the API. Related: issue #33
Sapphire provides a RestfulServer class that might help with getting set up.
Responses will be provided in json or XML format.
Customer Interactions
Get all products
Structure: GET baseurl/api/v1/products.format
Example: GET http://www.mysite.com/api/v1/products.json
Produces:
[{title:"Beach Ball",price:5.00},
{title:"Fishing Rod",price:14.00}]
Get single product
Example:
GET <baseurl>/api/v1/products
Add product to cart
...
Get cart contents & subtotals
...
Get shipping estimates
...
Place an order
...
Admin Interactions
Draw ideas from other apis http://doc.prestashop.com/display/PS14/Web-service+reference
May also be useful: http://blog.programmableweb.com/2011/09/09/breaking-down-e-commerce-apis/
Spree also has a great documentation site for their api: http://api.spreecommerce.com/
And note that their source is contained within a separate folder, apart from core code: https://github.com/spree/spree/tree/master/api
some ideas here: https://gist.github.com/jedateach/5409341