I’m trying to use the GetSegments endpoint in .NET like this:
public GetSegments ObtenerSegmentos()
{
var contactsApi = new ContactsApi();
GetSegments segs;
try
{
segs = contactsApi.GetSegments(50,0);
}
catch (Exception ex)
{
throw new Exception($"SIB_API_05-ErrorObteniendoSegmentos: {ex.Message}");
}
return segs;
}
But I get the following exception:
brevo_csharp.Client.ApiException: 'Cannot deserialize the current JSON array (e.g. [1,2,3]) into type ‹ brevo_csharp.Model.GetSegmentsSegments › because the type requires a JSON object (e.g. {« name »:« value »}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {« name »:« value »}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
It seems that it is not deserializing correctly. Could you please check this?