cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with the service layer in the Order POST

Arzch
Discoverer
0 Kudos
96

I use this endpoint
POST: http://xxxxxx:50003/b1s/v1/Orders
with this JSON

 

{

    "CardCode": "10260237-4C",

    "DocDate": "2025-03-19",

    "SalesPersonCode": -1,

    "Rounding": "tNO",

    "DocumentSubType": "bod_None",

    "Series": 13,

    "Comments": “Test",

    "DocumentLines": [

        {

            "ItemCode": "A00001",

            "PriceAfterVAT": 1785.0,

            "Quantity": 1.0,

            "TaxCode": "IVA",

            "WarehouseCode": "01"

        }

    ]

}

The response is :

{
    "error": {
        "code": -1,
        "message": {
            "lang": "en-us",
            "value": "BadFormat"
        }
    }
}
I changed the json to something simpler, but the error is the same.
{
    "CardCode": "10260237-4C",
    "DocDate": "2025-03-19",
    "DocumentLines": [
        {
            "ItemCode": "A00001",
            "Quantity": 1.0
        }
    ]
}
The product and business partner exist and are active
What's the problem? What am I missing?
 
View Entire Topic
ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Arzch,

I tested your JSON in Postman.

In the first request, Comments is using wrong format of double quotes. Kindly correct it and check.

The second request appears fine.

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

Arzch
Discoverer
0 Kudos
Thank you very much for the response, but after several attempts I discovered that I was missing the "DocDueDate" information in the JSON... that resolved the issue. Thank you very much in advance.
ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Arzch,

Ideally, it should trigger an error stating that 'DocDueDate is missing' or something similar.

The reason it's returning a 'Bad Post' error could be that you're using it differently or not capturing the correct response from the Service Layer.

Regardless, it's good to hear that the issue has been resolved.

Kind regards,

ANKIT CHAUHAN

SAP Business One Support