Create order with REST API, without cart

by sissy   Last Updated January 12, 2018 16:09 PM

I'm using REST API with token authentication to export data from a M1 to a fresh installation of M2.2.0 installation.

Everything works fine with customers and products, but I cannot manage to understand how to create an order without creating a cart.

I mean, I already have all needed data from the order, there should be no need to create a cart before, as suggested in all the solutions I found (also in the official magento guide.

I'm following same steps in the above mentioned guide, but trying to post data about the order, I keep getting the error:

{"message":"%fieldName is a required field.","parameters":{"fieldName":"customer"}}

and this is a sampl JSON I'm using to make my tries:

{"order":{"customer":{"id":6,"email":"nuovaprova12@example.com","firstname":"francesca","lastname":
         "nera","storeId":1,"websiteId":1},"discount_amount":0,"grand_total":120,"increment_id":"200001414155","shipping_amount":7,"status":"processing","store_id":1,
        "subtotal":100,"tax_amount":20,"items":{"description":"prodotto mio","item_id":3,"price":10,"product_id":3,"product_type":"simple",
        "qty_ordered":2,"sku":"002","tax_amount":2,"weight":1}},"billing_address":
        {"firstname":"giuseppa","lastname":"rossi","company":"mycompany","city":"rome","region":"california","region_id":12,"postcode":"12312","telephone":"1234556677","country_id":"US","street":["via prima","via seconda"]},
        "payment":{"amount_paid":120,"method":"check"},"status_histories":
    [{"status":"processing"}],"extension_attributes":{"shipping_assignments":
    [{"shipping":{"address":
    [{"firstname":"franca","lastname":"vardi","company":"mycompany","city":"rome",
    "region":"california","region_id":12,"postcode":"12312","telephone":"1234556677",
    "country_id":"US","street":
    ["via prima","via seconda"]}],
    "method":"string","total":{"base_shipping_amount":7}},"items":[{"description":"prodotto mio",
    "item_id":3,"price":10,"product_id":3,"product_type":
"simple","qty_ordered":2,"sku":"002","tax_amount":2,"weight":1}]}]}}


Related Questions


update order status in magento2 using rest API

Updated April 13, 2017 09:09 AM

Call a REST API after successfull order placement

Updated April 02, 2018 20:09 PM


get order by string/value in product_options array

Updated April 10, 2018 20:09 PM