PATCH https://bc365test:7048/BC160/api/mycomp/jobs/v1.0/jobServiceLines('JO00003','SV01')?company=xyz If-Match: "*" { "lineamount": 400.2 }... but when batching requests like so:
POST https://bc365test:7048/BC160/api/mycomp/jobs/v1.0/$batch { "requests": [ { "method": "PATCH", "url": "jobServiceLines('JO00003','SV01')", "headers": { "company": "xyz", "Content-Type": "application/json", "If-Match": "*" }, "body": { "lineamount": 400.2 } } ] }I get the response:
"error":{"code":"BadRequest","message":"Invalid Request Body CorrelationId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx."}If I just send an integer "lineamount" value it works fine.
Answers
Here is an link to an article that explains that this is a bug:
https://www.kauffmann.nl/2021/01/06/batch-calls-with-business-central-apis-3-tips-and-tricks/
The way to fix this is to add the following to your Content-Type header:
IEEE754Compatible=true
That way, your Content-Type header would look like this:
application/json;IEEE754Compatible=true