(412) Precondition Failed

New Member
26 0 0
I have an application that performs all sorts of operations via the API but when I am trying to add a collect I am getting a "(412) Precondition Failed" response. Below is the post body and headers that I am sending: /admin/collects.xml ===================================================== <?xml encoding="UTF-8" version="1.0"><collect><product-id type="integer">8640032</product-id><collection-id type="integer">1286842</collection-id></collect> Authorization: Basic ZTY4MDlhNjZkNz...[snip] Content-Type: application/xml Host: gcsartstamps.myshopify.com Content-Length: 157 ===================================================== Any ideas?...Anyone?
0 Likes
New Member
26 0 0

I ran the same post through another library so that I was able to see the response more clearly and this is what I received.


412<?xml version="1.0" encoding="UTF-8"?>
<errors>
  <error>this link already exists...</error>
</errors>

I am guess that this is the response when trying to add a collect that already exists but I think this is the wrong HTTP status code to use. My understanding the the 412 error is that the server is telling the client that the request contains a header that it is unable or unwilling to comply with.

Specifically when using the Dot.Net HttpWebRequest object it is treated as exception.

I will just code around it for now but perhaps a 200 response is just fine. I mean if the collect I am trying to add already exists then a 200 response confirms for me that the collect well…that it exists :)

0 Likes