POST: admin/api/2020-01/orders.json > return 200, <Continue> Link

Solved
Highlighted
Tourist
4 0 1

Screenshot from 2020-02-11 11-30-37.png

When I creating an order API retrun a HTML contentPlease help me to understand this issue

0 Likes
Highlighted

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

Shopify Development | Custom Apps | hello@achieveapplabs.com
1 Like
Highlighted
Tourist
4 0 1

Hi 

 

0 Likes
Highlighted
Excursionist
10 1 0

Can you share with me the headers (request and response both) and full-body payload?

0 Likes
Highlighted

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

Shopify Development | Custom Apps | hello@achieveapplabs.com
0 Likes
Highlighted

Success.

Shopify Expert
9852 98 1617

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.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
2 Likes

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:

 

postman_cookies.PNG

 

{
    "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. 

Shopify Development | Custom Apps | hello@achieveapplabs.com
0 Likes
Highlighted

Success.

@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

Shopify Development | Custom Apps | hello@achieveapplabs.com
1 Like
Highlighted
Tourist
4 0 1

image.pngimage.png

API URL: https://2bd2esdsdsd586146a00997072b44cd41aed77:1587d3sdswewwe40244e5c46afd90530884e3e5a741@the-trimming-company.myshopify.com/admin/api/2020-01/orders.json   (Key: pass are wrong)

0 Likes
Highlighted
Tourist
4 0 1

@Jason @achieveapplabs @newtonx  Thanks for your great support. 
It is working fine in Node, cookies are the main villain in postman. Again thanks for you all...

1 Like