Skip to content

ApiException: cannot unmarshal number into int64 in CreateBatchOrderAsyncWithHttpInfo #12

@DmitriyKulagin

Description

@DmitriyKulagin

Description:
We are currently using the official brevo-csharp library v1.0.0.

During order synchronization, we call the method: CreateBatchOrderAsyncWithHttpInfo()

However, every request fails with the following exception:

brevo_csharp.Client.ApiException: Error calling CreateBatchOrder: 
{ 
  "code": "invalid_parameter", 
  "message": "decode: json: cannot unmarshal number 2.0 into Go struct field httpProductDetail.orders.products.quantity of type int64"
}

Steps to Reproduce:

Use brevo-csharp v1.0.0.
Call CreateBatchOrderAsyncWithHttpInfo() with order data containing product quantities. The “quantity” property in the API is of type “decimal?”, we pass the value of this field as “int” (C#).
Observe the thrown ApiException.

Expected Behavior:
The API should correctly accept product quantities and process the batch order request without throwing an exception.

Actual Behavior:
The API rejects the request due to a type mismatch, attempting to parse a floating-point number (e.g., 2.0) into an int64 field.

Additional Details:
In your documentation (Import your orders), it is defined as type number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions