79717331

Date: 2025-07-28 12:38:43
Score: 0.5
Natty:
Report link

After checking all the possibilities now I can able to get the data based on the search parameters.

this is final working code.

client = new RestClient();

var listRequest = new RestRequest($"https://api.bexio.com/2.0/kb_order/search", Method.Post);

var searchParameters = new OrderSearchParameter[]
{
    new OrderSearchParameter 
    {
        field = "search_field",
        value = "search_value",
        criteria = "="
    }
};

var jsonValue = JsonSerializer.Serialize(searchParameters);

listRequest.AddHeader("Accept", "application/json");
listRequest.AddHeader("Authorization", $"Bearer {config.AccessToken}");
listRequest.AddHeader("Content-Type", "application/json");
listRequest.AddHeader("Content-Length", Encoding.UTF8.GetByteCount(jsonValue));

listRequest.AddBody(searchParameters, "application/json");

RestResponse listResponse = await client.ExecuteAsync(listRequest, cancellationToken);
if (!listResponse.IsSuccessful)
{
    Console.WriteLine($"API request failed: {listResponse.ErrorMessage}");
}
else if (listResponse.Content != null)
{
    // success
}

One thing missing here is limit. If I add limit it shows the error, I don't know the reason actually.

Thank you everyone!!!

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Mokshith Gowda