답변:
나는 마침내 그것을 알아 냈습니다. 여기 내가하고있는 일이 있습니다.
curl -g -X GET "$base_url/index.php/rest/V1/products/24-MB05/" \
-H "Authorization: Bearer $token"
curl -g -X POST "$base_url/index.php/rest/V1/guest-carts/" \
-H "Authorization: Bearer $token"
curl -g -X GET "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5" \
-H "Authorization: Bearer $token"
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 } }'
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": "abc@abc.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": "abc@abc.com",
"prefix": "address_",
"region_code": "MH"
},
"shipping_method_code": "flatrate",
"shipping_carrier_code": "flatrate"
}
}
'
curl -g -X GET "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/payment-information" \
-H "Authorization: Bearer $token"
curl -g -X PUT "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/order" \
-H "Authorization: Bearer $token" \
-H "Content-Type:application/json" \
-d '
{
"paymentMethod": {
"method": "checkmo"
}
}'
빈 장바구니 URL 만들기 : http : // www. [yoursite] .com / rest / V1 / carts / mine 전화 : 응답 게시 : cartID 예 : 4290
장바구니 URL에 품목 추가 : http : // www. [yoursite] .com / rest / V1 / carts / mine / items body :
{"cartItem":{
"sku":"JFCO00017",
"qty":1,
"name":"Devil May Cry III 3 Dante",
"price":81.55,
"product_type":"simple",
"quote_id":"4290",
"product_option":
{"extension_attributes":
{
"custom_options":[
{"option_id":"thumbnail",
"option_value":"\/d\/e\/devilmaycryiii3dantecosplay_1_.jpg"
},
{
"option_id":"color_2",
"option_value":"Red"
},
{
"option_id":"google_size",
"option_value":"xxs"}]
}
}
}
}
청구 정보 URL 추가 : http : // www. [yoursite] .com / rest / V1 / carts / mine / billing-address body :
{
"address": {
"city": "Springfield",
"company": "iprag",
"countryId": "IN",
"email": "customer_email@domain.com",
"firstname": "Jane",
"lastname": "Doe",
"postcode": "90210",
"region": "UP",
"saveInAddressBook": 1,
"street": ["Street"],
"telephone": "5551234"
},
"useForShipping": true
}
배송 방법 URL 받기 : http : // www. [yoursite] .com / rest / V1 / carts / mine / shipping-methods
{
"carrier_code": "flatrate",
"method_code": "flatrate",
"carrier_title": "Flat Rate",
"method_title": "Fixed",
"amount": 10,
"base_amount": 10,
"available": true,
"error_message": "",
"price_excl_tax": 10,
"price_incl_tax": 10
}
배송 정보 URL 추가 : http : // www. [yoursite] .com / rest / V1 / carts / mine / shipping-information body :
{
"addressInformation": {
"billingAddress": {
"city": "Springfield",
"company": "iprag",
"email": "customer_email@domain.com",
"firstname": "Jane",
"lastname": "Doe",
"postcode": "335001",
"region": "UP",
"street": ["Street"],
"telephone": "5551234"
},
"shippingAddress": {
"city": "Springfield",
"company": "iprag",
"email": "customer_email@domain.com",
"firstname": "Jane",
"lastname": "Doe",
"postcode": "335001",
"region": "UP",
"street": ["Street"],
"telephone": "5551234"
},
"shippingCarrierCode": "flatrate",
"shippingMethodCode": "flatrate"
}
}
응답 : 결제 수단 및 장바구니 세부 정보
주문 장소 URL : http : // www. [yoursite] .com / rest / V1 / carts / mine / order body :
{
"paymentMethod":{"method":"checkmo"},
"shippingMethod":
{
"method_code":"flatrate",
"carrier_code":"flatrate",
"additionalProperties":{}
}
}
응답 : orderid
REST API를 통해 주문하는 방법을 보여주는 공식 학습서 가 있습니다 .
Magento 2.2의 주문 처리 학습서
그들은 매우 상세한 단계를 포함했다 :
이 튜토리얼에는 다양한 종류의 제품을 추가하는 방법, 다른 배송 방법 및 샘플 코드를 포함한 많은 유용한 정보가 포함되었습니다.