Page 1 of 1

Error Creating Purchase Order Receipt via API

Posted: Fri Sep 17, 2021 3:47 am
by HNCDev
Hi,

I am trying to work out how to create purchase order receipts via the API. I have tried to follow the API documentation and no matter what I try I get the same error (below). The error doesn't really provide any information as to what the problem is so I'm a bit stuck.

Status 422 - Unprocessable Entity

Reponse:

Code: Select all

"errors": [
{
"path": null,
"message": "No data to be inserted for vendor receipt.",
"value": null
}
]

Request:
POST {{SimPRO_BaseURL}}/api/v1.0/companies/{{CompanyID}}/vendorOrders/{{vendorOrderID}}/receipts/

Code: Select all

{
"VendorInvoiceNo": "PO134345",
"PackingSlipNo": "PS2154",
"Notes": "This one was created via the API",
"ExchangeRate": 1,
"DateIssued": "2021-09-17",
"Category": 0,
"TaxAdjustment": 0,
"FreightTaxCode": 1,
"Freight": {
"ExTax": 0
},
"Total": {
"ExTax": 591
},
"ItemsReceived": true
}

Re: Error Creating Purchase Order Receipt via API

Posted: Fri Sep 17, 2021 4:13 am
by Muqeet
This usually happens when the request data is not correctl, json format could be wrong or may be you would need to pass the Content-Type: application/json in request headers.

Re: Error Creating Purchase Order Receipt via API

Posted: Fri Sep 17, 2021 5:52 am
by HNCDev
Thanks adding the request header Content-Type: application/json did the trick.