Discussing APIs and development related to customers, discounts, and order management.
When I creating an order API retrun a HTML contentPlease help me to understand this issue
Solved! Go to the solution
This is an accepted solution.
HTML response via postman is most likely related to sending cookies in the request. If using the desktop version just find the cookies button, click it, and remove all cookies being sent.
This is an accepted solution.
@VipinRV Ok I finally was able to create an order. The docs aren't clear exactly what fields within line_items object are required or mandatory. So below is the minimum to create an order:
{ "order": { "email": "email@mail.com", "line_items": [ { "variant_id": 4572523364490, "quantity": 1, "price": "200.0", "name": "charm bracelet", "title": "something" } ] } }
Note: The Variant_id is actually my product id in case you're using product without variants just stick the ID of the product in variant_id property.
Hope this helps I know it can be frustrating, what actually helped me was the response messages similar to below:
{ "errors": { "order": [ "Line items is invalid" ], "line_items": [ "Name can't be blank", "Title can't be blank" ] } }
Regards,
Sam
Hello,
To use Shopify Order API you should be sending the request along with your app key and secret token. If you are signed into Shopify admin then you can send a GET request to xxxxxxxxx.myshopify.com/admin/orders.json. Assuming you could also POST to this URL as well.
Regards,
Sam
Hi Achieveapplabs,
I did the same as you said. But the same error occurred. I got this same error on Product API, it was occurred by some data error. But the order case is different.
Can you share with me the headers (request and response both) and full-body payload?
API URL: https://2bd2esdsdsd586146a00997072b44cd41aed77:1587d3sdswewwe40244e5c46afd90530884e3e5a741@the-trimming-company.myshopify.com/admin/api/2020-01/orders.json (Key: pass are wrong)
Hi @VipinRV I'm going to test with postman creating a simple order. Getting HTML as a return means the POST body you sent was likely the issue. If you can reply with the POST body you're sending without any sensitive info like customer details I will attempt to use yours.
Regards,
Sam
This is an accepted solution.
HTML response via postman is most likely related to sending cookies in the request. If using the desktop version just find the cookies button, click it, and remove all cookies being sent.
Hi @VipinRV,
We tried on our end and keep getting the below error, please take Jason's advice and delete cookies in Postman by clicking cookies:
{ "errors": { "order": "Required parameter missing or invalid" } }
@Jason Yup deleting cookies in Postman cleared up the HTML as a response issue as we ran into it during this test.
This is an accepted solution.
@VipinRV Ok I finally was able to create an order. The docs aren't clear exactly what fields within line_items object are required or mandatory. So below is the minimum to create an order:
{ "order": { "email": "email@mail.com", "line_items": [ { "variant_id": 4572523364490, "quantity": 1, "price": "200.0", "name": "charm bracelet", "title": "something" } ] } }
Note: The Variant_id is actually my product id in case you're using product without variants just stick the ID of the product in variant_id property.
Hope this helps I know it can be frustrating, what actually helped me was the response messages similar to below:
{ "errors": { "order": [ "Line items is invalid" ], "line_items": [ "Name can't be blank", "Title can't be blank" ] } }
Regards,
Sam