Created
May 29, 2017 08:52
-
-
Save phamngsinh/348c4b3c4e1dc84e0b9976644202a1e1 to your computer and use it in GitHub Desktop.
Magento 2 - Create order using REST API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get a single product | |
| curl -g -X GET "$base_url/index.php/rest/V1/products/24-MB05/" \ | |
| -H "Authorization: Bearer $token" | |
| Create cart | |
| curl -g -X POST "$base_url/index.php/rest/V1/guest-carts/" \ | |
| -H "Authorization: Bearer $token" | |
| Get Cart | |
| curl -g -X GET "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5" \ | |
| -H "Authorization: Bearer $token" | |
| Add Product To Cart | |
| curl -g -X POST "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/items" \ | |
| -H "Authorization: Bearer $token" \ | |
| -H "Content-Type:application/json" \ | |
| -d '{ "cartItem": { "quote_id": "56241bf6bc084cd7589426c8754fc9c5", "sku": "24-MB05", "qty": 1 } }' | |
| Add shipping information | |
| curl -g -X POST "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/shipping-information" \ | |
| -H "Authorization: Bearer $token" \ | |
| -H "Content-Type:application/json" \ | |
| -d ' | |
| { | |
| "addressInformation": { | |
| "shippingAddress": { | |
| "region": "MH", | |
| "region_id": 0, | |
| "country_id": "IN", | |
| "street": [ | |
| "Chakala,Kalyan (e)" | |
| ], | |
| "company": "abc", | |
| "telephone": "1111111", | |
| "postcode": "12223", | |
| "city": "Mumbai", | |
| "firstname": "Sameer", | |
| "lastname": "Sawant", | |
| "email": "paul@qooar.com", | |
| "prefix": "address_", | |
| "region_code": "MH", | |
| "sameAsBilling": 1 | |
| }, | |
| "billingAddress": { | |
| "region": "MH", | |
| "region_id": 0, | |
| "country_id": "IN", | |
| "street": [ | |
| "Chakala,Kalyan (e)" | |
| ], | |
| "company": "abc", | |
| "telephone": "1111111", | |
| "postcode": "12223", | |
| "city": "Mumbai", | |
| "firstname": "Sameer", | |
| "lastname": "Sawant", | |
| "email": "paul@qooar.com", | |
| "prefix": "address_", | |
| "region_code": "MH" | |
| }, | |
| "shipping_method_code": "flatrate", | |
| "shipping_carrier_code": "flatrate" | |
| } | |
| } | |
| ' | |
| Get Payment Method | |
| curl -g -X GET "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/payment-information" \ | |
| -H "Authorization: Bearer $token" | |
| Place Order | |
| curl -g -X PUT "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/order" \ | |
| -H "Authorization: Bearer $token" \ | |
| -H "Content-Type:application/json" \ | |
| -d ' | |
| { | |
| "method": { | |
| "method": "checkmo" | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment