0
votes

Using POST via an HTTP Client we are having a little trouble adding some redirects to our store via the Shopify API using a Private App we created.

https://apikey:password@hostname/admin/redirects.xml 

We are getting an HTTP/1.1 400 Bad Request with the following error:

<error>Extra content at the end of the document</error>

Have tried entering the sample code from Shopify API: http://api.shopify.com/redirect.xml.html#create

POST /admin/redirects.xml HTTP/1.1
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8"?>
<redirect>
  <path>/ipod</path>
  <target>/pages/itunes</target>
</redirect>

If we do one redirect at a time it is fine if we have more than one then it fails, how do you batch redirects?

1
Are there any error returned? Did you set the content type to XML? - John Duff
Missed the Content-Type It is now working for Single Instances.... If I try to add more than 1 redirect I get a Bad Request Error <error>Extra content at the end of the document</error> - user1643897

1 Answers

1
votes

You can only creat one at a time, you will need to loop over and send a request for each.