There will be no index resource for /line-item itself, but we will accommodate that through an order relationship (i.e. order/1/line-items). This issue will be used to implement the create code for POSTing new resources. Specifically we want an Add to Cart function through a simple POST like:

POST /line-item

{'order_id': 1, 'type': 'product', 'commerce_product': 2}

That should be functionally equivalent to adding product 2 to order 1.

Comments

rszrama’s picture

Status: Active » Needs work

Almost there. This patch includes index, retrieve, create, update, and delete resources for line items. Just need to get their order relationship in now.

Commit: http://drupalcode.org/project/commerce_services.git/commitdiff/819f08a

rszrama’s picture

Status: Needs work » Fixed

And now with an order relationship to do something like:

GET /order/1/line-items
GET /order/1/line-items?fields=type,line_item_label,quantity,commerce_unit_price,commerce_total

Commit: http://drupalcode.org/project/commerce_services.git/commitdiff/c047054

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

cimo75’s picture

Issue summary: View changes

Hallo,
{'order_id': 1114, 'type': 'product', 'commerce_product': 447}
returns
401 Unauthorized : Missing required argument data
What is missing there?
tx
Simone