Can't create order with API

martabel
Shopify Partner
40 0 1

Development store.

 

POST https://myshop.com/admin/api/2019-07/orders.json

 

{
  "order": {
    "line_items": [
      {
        "title": "Big Brown Bear Boots",
        "price": 74.99,
        "grams": "1300",
        "quantity": 3,
        "tax_lines": [
          {
            "price": 13.5,
            "rate": 0.06,
            "title": "State tax"
          }
        ]
      }
    ],
    "transactions": [
      {
        "kind": "sale",
        "status": "success",
        "amount": 238.47
      }
    ],
    "total_tax": 13.5,
    "currency": "EUR"
  }
}

Answer is this(Using postman): 

 

<html>

<body>
	<noscript>
		<a
			href="https://app.shopify.com/services/login/iSOMESTUFFTHATICOMMENTEDOUTMAYBEITSDELICATE">Continue</a>
	</noscript>

	<script type="text/javascript">
		window.location = "https:\/\/app.shopify.com\/services\/login\/identity?destinationSOMESTUFFTHATICOMMENTEDOUTMAYBEITSDELICATE";
	</script>
</body>

</html>

 

Updating a existing order works well.

0 Likes

Hello 

You want to create simple product?
or you have product variant?

Want to modify or incorporate custom changes on store, Hire us
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Whats app
Free Website Review and advice for sale from Shopify Conversion Experts | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | Shopify SEO ; Digital Marketing & amp | Site Speed Optimization | Performance Site Audit
0 Likes
martabel
Shopify Partner
40 0 1

@oscprofessional 

Hey I want to create a order so It would end up here myurl.com/admin/orders

0 Likes

Hello 

 "line_items": [
      {
        "variant_id": 457924702,
        "quantity": 1
      }
    ]

 

Want to modify or incorporate custom changes on store, Hire us
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Whats app
Free Website Review and advice for sale from Shopify Conversion Experts | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | Shopify SEO ; Digital Marketing & amp | Site Speed Optimization | Performance Site Audit
0 Likes
martabel
Shopify Partner
40 0 1

Same problem  @oscprofessional 

 

I requested my last orders https://xxx.myshopify.com/admin/api/2019-07/orders.json

 

And tried with the variant id-s i found there. But I am getting the same response. Does It work for you?

0 Likes

Hello 
Yes, this works for me.

Want to modify or incorporate custom changes on store, Hire us
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Whats app
Free Website Review and advice for sale from Shopify Conversion Experts | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | Shopify SEO ; Digital Marketing & amp | Site Speed Optimization | Performance Site Audit
0 Likes
martabel
Shopify Partner
40 0 1

I don't understand what I am doing wrong. POST with postman. Other requests work like updating order with PUT.

0 Likes
jvantroyen
Tourist
5 0 1

Same problem, I can retrieve the orders fine, but if I do a POST to the same endpoint, I get that HTML reply @martabel described.

It looks like a login url, but if I follow it, it gives an error.

Is any specific header needed to get the expected 201 Created response?

0 Likes
jvantroyen
Tourist
5 0 1

Nevermind: Shopify rejects all POST using Basic Auth if they contain cookies. Postman alwasy sends (hidden) cookies.
(https://shopify.dev/tutorials/authenticate-a-private-app-with-shopify-admin#make-authenticated-reque...)

Changed to authentication with Shopify access token and it worked.

0 Likes