Redirection Problem Occurred

Solved
Excursionist
23 2 1

Hoping someone can help.  I am trying to post an order via the API - something which has worked in the past.  While I was adjusting the JSON to get it right I was getting 'error' replies from the API but now that I have corrected those issues, there seems to be a timeout type of problem when I reach the 'Send' line of my HTTP Post and the error returned is simply, and rather unhelpfully, "A redirection problem occurred."  As far as I can tell my JSON is now correct but it is not creating an order in the Shopify shop.  This is the JSON Data that my system has created, in case anyone can see anything wrong with it.  All I have changed on this is the email address:

{ "order": { "name": "56776", "email": "xxxx", "fulfillment_status": "paid", "discount_applications":[ { "type":"discount_code", "value":"10", "value_type":"percentage", "allocation_method":"across", "target_selection":"all", "code":"Whole Order Discount" } ], "discount_codes":[ { "code":"Whole Order Discount", "amount":"3.22", "type":"percentage" } ],"line_items": [ { "title": "Zambroza®", "price": "16.23", "quantity": "1", "tax_lines": [ { "price": "0.00", "rate": "0", "title": "VAT" } ] }, { "title": "Zinc", "price": "7.19", "quantity": "1", "tax_lines": [ { "price": "1.44", "rate": "0.2", "title": "VAT" } ] }, { "title": "Vitamin D3", "price": "7.91", "quantity": "1", "tax_lines": [ { "price": "1.58", "rate": "0.2", "title": "VAT" } ] } ], "total_price": "32.19", "total_tax": "5.22", "currency": "GBP" } }

I can see that there is a spurious "A" at the end of Zambroza but the title has come originally from Shopify, so I am assuming it can cope with having it back.

Any thoughts would be very welcome.  Thanks in advance.

0 Likes
Shopify Staff
Shopify Staff
1555 79 244

That's strange. Are you receiving an x-request-id response header? If so, could you share that here? I can use that to check logs on my end.

0 Likes
Excursionist
23 2 1

I am not aware of any response at all - just the error as reported.  I have tried a different example without the strange character and it has the same problem.  I was getting responses while I built this JSON telling me of the errors I had in it, but now that it is correct I am not getting a response from the API at all.  It hangs for a few seconds and then I get this 'timeout' error as reported within my system.  I have checked again today, in case it was a strange thing that somehow cured itself, but I still have the error.

0 Likes
Excursionist
23 2 1

I am now trying this with a much simpler order, for which the json is 

{ "order": { "name": "56775", "email": "xxxx", "fulfillment_status": "paid", "line_items": [ { "title": "Acti-Biotic", "price": "17.31", "quantity": "1", "tax_lines": [ { "price": "3.46", "rate": "0.2", "title": "VAT" } ] } ], "total_price": "17.31", "total_tax": "2.88", "currency": "GBP" } }

The email matches an existing customer

My sending code (VBScript) looks like this and has worked until now (the variable jsondata holds the json above):

Set xmlhttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
xmlhttp.Open "POST", "https://<shopname>.myshopify.com/admin/api/2019-04/orders.json", false, "<apiusername>", "<apipassword>"
xmlhttp.setRequestHeader "Content-Type", "application/json; charset=utf-8"
xmlhttp.setRequestHeader "Content-Length", Len(jsondata)
xmlhttp.Send jsondata 
Set xmlhttp = nothing


I have tried using Msxml2.ServerXMLHTTP.3.0 and that has the same issue.  If I use Msxml2.ServerXMLHTTP.6.0 it acts very strangely and redirects to the admin page of the Shopify Shop, but still doesn't create the order.  However, for these POSTs in the past Msxml2.ServerXMLHTTP has been the one that works.

 

Desperate for some help here :( 

0 Likes

Success.

Excursionist
23 2 1

I have made some headway with this but now have a different problem which I will present in a new post so as not to confuse. 

0 Likes
Highlighted
New Member
8 0 0

Can you please share what you did to fix the redirection issue? I'm getting the same error in my vbscript

0 Likes
Excursionist
23 2 1

Unfortunately the solution was very unsatisfactory in that I had to move the script that sent the order over to a different server with an older operating system.  It seems that the issue is caused by a Windows update on the newer server OSs.  Although this solution works, it is far from ideal as it adds in an extra point of potential failure.

0 Likes