sendinblue / APIv3-java-library

SendinBlue's API v3 Java Library
MIT License
42 stars 12 forks source link

Error when calling campaignApi.getEmailCampaign(id) for campaign without scheduled date #27

Closed dmarko484 closed 1 year ago

dmarko484 commented 3 years ago

Hello, I'm using the latest version of this api (v5.0.0) for creating campaigns and got a following issue. a) I'm creating a campaign using api without 'scheduledAt' field being assigned. This field is not mandatory so campaign is created and I can see it in SendinBlue UI. b) now when I'm trying to load campaign info using campaignApi.getEmailCampaign(id) I'm getting error from whithin an api:

org.threeten.bp.format.DateTimeParseException: Text '' could not be parsed at index 0
    at org.threeten.bp.format.DateTimeFormatter.parseToBuilder(DateTimeFormatter.java:1587)
    at org.threeten.bp.format.DateTimeFormatter.parse(DateTimeFormatter.java:1491)
    at org.threeten.bp.OffsetDateTime.parse(OffsetDateTime.java:359)
    at sendinblue.Json$OffsetDateTimeTypeAdapter.read(Json.java:196)
    at sendinblue.Json$OffsetDateTimeTypeAdapter.read(Json.java:160)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
    at com.google.gson.Gson.fromJson(Gson.java:887)
    at com.google.gson.Gson.fromJson(Gson.java:852)
    at com.google.gson.Gson.fromJson(Gson.java:801)
    at sendinblue.Json.deserialize(Json.java:126)
    at sendinblue.ApiClient.deserialize(ApiClient.java:713)
    at sendinblue.ApiClient.handleResponse(ApiClient.java:916)
    at sendinblue.ApiClient.execute(ApiClient.java:843)
    at sibApi.EmailCampaignsApi.getEmailCampaignWithHttpInfo(EmailCampaignsApi.java:649)
    at sibApi.EmailCampaignsApi.getEmailCampaign(EmailCampaignsApi.java:635)

The only date field on campaign is scheduledAt so I tested this here and there and found that when 'scheduledAt' is not assigned, campaign can't be deserialized in GSon. For our use case we can't assign 'scheduledAt' when creating campaign so then it fails when trying to read it using an api. Can you fixed this or do you have any workaround?

btw. I can see it was reported already here: https://github.com/sendinblue/APIv3-java-library/issues/13 for an older version ...

Thanks, David Marko

Kool-Hussain commented 1 year ago

Hi @dmarko484, Latest version of this api is (v6.0.0) and it is working fine on this version. If you upgrade with the latest version, issue will be resolved. Please let me know in case you still encounter the same issue. Thank You

Kool-Hussain commented 1 year ago

Hi @dmarko484, As mentioned above this is working fine, closing this issue, please feel free to reopen if you still feel this issue. Thanks