intercom/intercom-dotnet

Deserialize Exception: UserList.Scroll Response total_count field is null

Closed this issue ยท 6 comments

This sounds more like an API error on Intercom's end. I haven't looked to see if they changed anything about their guarantee of the "total_count" field.

It also sounds semi-related to the previous mention of null UserLists (#140), which I guess was also an error on Intercom's end. I've tested the actual response from api.intercom.com and the "total_count" field in the response is null. The list is also not empty in the slightest, and it does return a "scroll_param" and all the other typical fields you would expect.

Obviously this is hitting an exception when attempting to deserialize because the "total_count" field on intercom-dotnet Models class is just an int, and not a nullable int.

I've found that many libraries for REST APIs will almost always make all value-type fields as Nullable. Just to ensure deserialization won't freak out like this. It may be something to consider.

Edit: Forgot to mention it is specifically the scroll API for users, not the normal users call.

I'm blocked by the same issue, since December 11th.

As a workaround you can set global default JsonConvert.DefaultSettings = () => new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
Or replace Deserialize method via overriding HandleResponse method
See https://github.com/intercom/intercom-dotnet/blob/master/src/Intercom/Core/Client.cs

Thanks for reporting this. We're currently working on an API update that should fix this ASAP. We'll let you know ๐Ÿ‘

@apassant @nicholi This is working again now.

Thanks for confirming. We've fixed the issue in the API, so everything should indeed be back to normal, w/o required SDK update.

I would like to report that this is still the case? total_count is 0