Skip to content

Oscar as an API

David Winterbottom edited this page Jul 21, 2014 · 1 revision

This is a scratchpad for ideas about reworking Oscar as a set of APIs.

For now, only non-dashboard functionality is included:

Catalogue

Use a single API for all product searching/browsing:

GET /products/{?category_id,offer_id,range_id,q}

GET /products/{id}/

Q: Should the product detail API contain all product information (attributes, stockrecords etc)?

GET /categories/

GET /categories/{category_id}/

GET /offers/

GET /offers/{offer_id}/

GET /ranges/

GET /ranges/{range_id}/

Basket

Fetch details of a user's basket:

GET /basket/

GET /basket/lines/

GET /basket/lines/{line_id}/

GET /basket/items/

Add a product/voucher to the basket

POST /basket/

Checkout

Fetch all details of current checkout session

GET /checkout-session/

Fetch all shipping addresses in user's address book

GET /checkout-session/shipping_addresses/{?country}

Set the shipping address for this checkout session

PUT /checkout-session/shipping-address/

Get available shipping methods (this will use the user, basket and shipping address)

GET /checkout-session/shipping-methods/

Set the shipping method for this checkout session

PUT /checkout-session/shipping-method/

Get available shipping methods

GET /checkout-session/payment-methods/

Submit an order

POST /orders/

Questions

  • How to handle authentication and user-owned resources - should we use /basket/ for a user's basket or user a ID in the URL, eg basket/213. That is, how much should we use the session for REST calls?

Todo

  • Look at other APIs to see how they do it (eg eBay)