REST Endpoints
Request/Response Formats
All of the endpoints below have the ability to produce and consume both XML and JSON. To ensure that you are receiving JSON in a response, ensure that this request HTTP header is set:
Accept: application/json
To tell the endpoint that you are sending it JSON (like in a PUT or POST), use this HTTP header:
Content-Type: application/json
And of course, to ensure that all requests/responses are in JSON, use both of those headers combined:
Accept: application/json
Content-Type: application/json
Functionality
The following provides a list of current RESTful endpoints provided with Broadleaf Commerce:
Catalog
URI | Description | Method | Query Parameters |
---|---|---|---|
/catalog/product/{id} | Returns a representation of a Broadleaf product by its ID | GET | None |
/catalog/search/products | Returns a representation of a paginated list of products along with any search facets that may be used to filter the search. | GET |
|
/catalog/search/category/{categoryId}/products | Returns a representation of a paginated list of products within a category, along with any search facets that may be used to filter the search. | GET |
|
/catalog/product/{id}/skus | Returns a list of skus for a particular product | GET | None |
/catalog/categories | Returns a representation of a paginated list of product categories | GET |
|
/catalog/category/{id}/categories | Returns a list of subcategories for a particular product category | GET |
|
/catalog/category/{id}/activeSubcategories | Returns a list of active subcategories for a particular product category | GET |
|
/catalog/category/{id} | Returns a representation of a product category, keyed by ID. Parameters allow one to control how much additional, nested data is returned. | GET |
|
/catalog/product/{id}/related-products/upsale | Returns a list of related upsale products for a particular catalog product | GET |
|
/catalog/product/{id}/related-products/crosssale | Returns a list of related cross sell products for a particular catalog product | GET |
|
/catalog/product/{id}/product-attributes | Returns a list of product attributes for a particular catalog product | GET | None |
/catalog/sku/{id}/sku-attributes | Returns a list of sku attributes for a particular catalog sku | GET | None |
/catalog/sku/{id} | Returns a representation of a particular catalog sku | GET | None |
/catalog/sku/{id}/media | Returns a list of media items for a particular catalog sku | GET | None |
/catalog/product/{id}/media | Returns a list of media items for a particular catalog product | GET | None |
/catalog/category/{id}/media | Returns a list of media items for a particular product category | GET | None |
/catalog/product/{id}/categories | Returns a list of categories for a particular product | GET | None |
Order
NOTE: The customer ID must be passed on each request. It can be passed on a query parameter or a request header. But it must be keyed as "customerId"**
URI | Description | Method | Query Parameters |
---|---|---|---|
/cart | Returns a representation of the customer's shopping cart. | GET | None |
/cart | Creates a new cart for the customer. If the customer ID is unknown because a customer record does not yet exist, it need not be passed in. A new customer will be created. The new cart along with the customer will be returned. | POST | None |
/cart/{categoryId}/{productId}/{skuId} | Adds the sku and its associated category and product references to the shopping cart. Optionally reprices the order. Returns a representation of the cart. | POST |
|
/cart/items/{itemId} | Deletes the item from the cart and optionally reprices the order | DELETE |
|
/cart/items/{itemId} | Updates the quantity of an item and optionally reprices the cart | PUT |
|
/cart/offer | Adds a promotional code to an order | POST |
|
/cart/offer | Deletes a promotional code from an order | DELETE |
|
/cart/offers | Deletes all promotional codes from an order and optionally reprices | DELETE |
|
/cart/fulfillment/groups | Returns a list of fulfillment groups for a particular order | GET | None |
/cart/fulfillment/groups | Deletes all fulfillment groups from an order | DELETE |
|
/cart/fulfillment/group | Adds a new fulfillment group to the order. Accepts a fulfillment group representation in JSON or XML format. | POST |
|
/cart/fulfillment/group/{fulfillmentGroupId} | Updates the fulfillment group identified by the ID in the URI. Accepts a fulfillment group representation in JSON or XML format. | PUT |
|
/orders | Returns a list of orders. The order history is for the customer who's ID is passed in. | GET |
|
Checkout
URI | Description | Method | Query Parameters |
---|---|---|---|
/cart/checkout | Accepts a list of PaymentMapWrapper representations in JSON or XML format. Returns a completed order. | POST | None |
/cart/checkout/payment/response | This should only be called for modules that need to engage the workflow directly without doing a complete checkout. For example, when using PayPal for doing an authorize and retrieving the redirect: url to PayPal. This takes in a single PaymentReferenceMap representation. Returns a PaymentResponseItem representation. | POST | None |