API / ODATA BATCH PATCH requests with decimal values

HeidiAlfordHeidiAlford Member Posts: 4
edited 2020-11-25 in NAV Three Tier
Hi all,

I have an ongoing project where an external system is using custom API's to update jobs in our Business Central (Onprem, 16) system.

Everything has been going fine until we start trying to use a combination of batching and numbers with decimal values in them. Send a single non-batched request with decimals - everything is fine. Send a batched request with a decimal value and it does not seem to like it.

For example the following request (Slightly modified example) works:
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.

Has anyone come across this or have any work-arounds (Short of making it a string value and parsing it in BC when I receive it)?

Sign In or Register to comment.