Solved

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

VipinRV
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

Accepted Solutions (2)
Jason
Shopify Expert
11190 225 2282

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.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★

View solution in original post

Not applicable

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

View solution in original post

Replies 9 (9)

Not applicable

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

VipinRV
Tourist
4 0 1

Hi 

 

newtonx
Shopify Partner
13 1 3

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

VipinRV
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)

VipinRV
Tourist
4 0 1

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

Not applicable

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

Jason
Shopify Expert
11190 225 2282

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.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Not applicable

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. 

Not applicable

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