2017-02-13 105 views
1

我想創建一個使用magento 2休息api的訂單。但送貨地址不添加訂單details.Because沒有送貨地址訂單是在不完整的格式Magento 2 Rest api創建訂單不添加送貨地址

http://127.0.0.1/netmeds_mage/rest/V1/orders/create 

Method : PUT 

這是JSON請求:

{ 「實體」:{ 「base_currency_code」: 「INR」, 「base_discount_amount」:0 「base_grand_total」:38, 「base_shipping_amount」:5, 「base_shipping_incl_tax」:5 「base_shipping_tax_amount」:0 「base_shipping_discount_amount」:0 「base_subtotal」:33, 「base_subtotal_incl_tax」:33,」 「base_to_global_rate」:1,「base_to_order_rate」:1,「discount_tax_compensation_amount」:0,「base_discount_tax_compensation_amount」:0,「shipping_discount_tax_compensation_amount」:0,「customer_is_guest」:0,「customer_dob」:「Jan 18, 「customer_firstname」:「sharvesh」,「customer_gender」:1,「customer_group_id」:1,「customer_id」:4,「customer_lastname」:「CP」, 「customer_note_notify」:1, 「DISCOUNT_AMOUNT」:0 「email_sent」:1, 「global_currency_code」: 「INR」, 「grand_total」:38, 「order_currency_code」: 「INR」, 「remote_ip」: 「127.0.0.1」, 「shipping_amount」:5,「shipping_tax_amount」:0,「shipping_description」:「Flat Rate - Fixed」,「shipping_discount_amount」:0,「shipping_incl_tax」:5,「state」:「pending」,「status」:「未決 「 」store_currency_code「: 」INR「, 」store_to_base_rate「:0 」store_to_order_rate「:0, 」STORE_ID「:1, 」小計「:33, 」subtotal_incl_tax「:33, 」total_due「:38」,以tal_item_count 「:1,」 total_qty_ordered 「:1,」 TAX_AMOUNT 「:0,」 重量 「:1,」 物品 「:[{」 base_original_price 「:33,」 BASE_PRICE 「:33,」 base_price_incl_tax 「:33,」 base_row_total」 :33,「base_row_total_incl_tax」:33,「name」:「Endeavor Daytrip Backpack」,「original_price」:33,「price」:33,「price_incl_tax」:33,「product_id」:11,「product_type」:「簡單」, 「qty_ordered」:1, 「ROW_TOTAL」:33, 「row_total_incl_tax」:33, 「SKU」: 「24-WB06」, 「STORE_ID」:1, 「重量」:1}], 「billing_address」:{ 「address_type」: 「結算」, 「城市」: 「奈」, 「公司」: 「Netmeds」, 「COUNTRY_ID」: 「IN」, 「customer_address_id」:4, 「電子郵件」: 「[email protected]」 「firstname」:「Sharvesh」,「lastname」:「C」,「郵編」:「600117」,「地區」:「Tamilnadu」,「街道」:[「6A,第4號 街,Keelkattalai」], 「:」 9840626148 「},」 付款 「:{」 amount_ordered 「:38,」 base_amount_ordered 「:38,」 base_shipping_amount 「:5」,方法 「:」 checkmo」, 「SHIPPING_AMOUNT」:5}, 「status_histories」:[ ], 「extension_attributes」:{ 「shipping_assignments」:[{」航運 「:{」 地址 「:{」 address_type 「:」 運輸」, 「城市」: 「奈」, 「公司」: 「Netmeds」, 「COUNTRY_ID」: 「IN」, 「customer_address_id」:4, 「電子郵件」 : 「[email protected]」, 「姓名」: 「Sharvesh」, 「姓」: 「C」, 「郵政編碼」: 「600117」, 「區域」: 「塔米爾納杜」, 「街道」:[「6A,第四「方法」:「flatrate_flatrate」,「total」:{「base_shipping_amount」:5,「base_shipping_incl_tax」:5,「shipping_amount」:5,「shipping_incl_tax」 :5],「extension_attributes」:[]},「items」:[{「base_original_price」:33,「base_price」:33,「base_price_incl_tax」:33,「base_row_total」:33,「name」:「Endeavor Daytrip 「價格」:33,「price_incl_tax」:33,「product_id」:11,「product_type」:「簡單」,「qty_ordered」:1,「row_total」:33,「row_total_incl_tax」,「3335」 「:33,」 SKU 「:」 24-WB06" , 「STORE_ID」:1, 「重量」:1}], 「extension_attributes」:[]}], 「applied_taxes」:[], 「item_applied_taxes」:[] ,「conversions_from_quote」:true}}}

告訴我是否缺少任何東西或我需要添加任何東西。

回答

0

根據模型方案(http://devdocs.magento.com/swagger/)你做錯過一些參數,我會嘗試啓動這個:

"shipping": { 
    "address": { 
    "address_type": "string", 
    "city": "string", 
    "company": "string", 
    "country_id": "string", 
    "customer_address_id": 0, 
    "customer_id": 0, 
    "email": "string", 
    "entity_id": 0, 
    "fax": "string", 
    "firstname": "string", 
    "lastname": "string", 
    "middlename": "string", 
    "parent_id": 0, 
    "postcode": "string", 
    "prefix": "string", 
    "region": "string", 
    "region_code": "string", 
    "region_id": 0, 
    "street": [ 
     "string" 
    ], 
    "suffix": "string", 
    "telephone": "string", 
    "vat_id": "string", 
    "vat_is_valid": 0, 
    "vat_request_date": "string", 
    "vat_request_id": "string", 
    "vat_request_success": 0, 
    "extension_attributes": {} 
    }, 
相關問題