phpweb-servicesdrupaldrupal-7drupal-commerce

How to post data to drupal commerce services?


I'm uses Drupal commerce services for mobile commerce. But I don't know how to Post jSON to REST service Cart or Order. With Comment services I"m post JSON successful as below:

URL: [http://myserver.com/services/comment/][1]
METHOD: POST
JSON BODY:
{
    "comment":{
      "comment_body":{
        "und":[
          {"value":"Good job"}
        ]
      },
      "nid":"23",
      "subject":"Drupal Services Comment"
    }
}

I don't know what is JSON Body to POST to Cart or Order Service like that? Anyone help me? Thanks


Solution

  • I found JSON structure for Cart or Order Services. It's something as below:

    {
       "type":"commerce_order",
       "commerce_customer_billing":"10",
       "commerce_line_items":
           [
               "11",
               "13",
               "14",
               "15",
               "16"
           ]
    }