Unexpected response on PUT /purchase_order/po_id/

I’m trying to mark a PurchaseOrder as sent, and the HTTP response I get does not make sense to me. Given that I have a purchase order with po_id 20160927-123456, when I send the request

PUT /purchase_order/20160927-123456/
In the post-data, I include the current time (as sent) and the warehouse ID.

I get the response

A purchase order already exists with that po_id u’20160927-123456’ for company_id 987654

The problem is… I know a PO with that ID already exists, which is why I’m sending a PUT request rather than a POST. Thus the error is telling me what I know, but not telling me why it matters. Has anyone else encountered and/or solved this problem?

Hi,

This error will occur if you are sending the request PUT /purchase_order/xyz/ and then including {'po_id': 'xyz'} in the data.

Could you also be sending 'po_id' in the request? This would update the purchase order id for you if you wanted to change it.

I’m definitely doing that, so I will try it without. The documentation seemed to indicate that it was required: https://i.imgur.com/5ETj1dd.png

Agreed, it looks like we need to better differentiate between POST and PUT payloads.
Thanks for pointing that out, and I hope the change worked!

Yes, the change worked and I was able to successfully mark the Purchase Order as sent. Thanks for your help!

1 Like