sachaos/todoist

request for completed items returns Error: json: cannot unmarshal number into Go struct field CompletedItem.items.user_id of type string

dasice opened this issue ยท 8 comments

dasice commented

I'm assuming this is a deprecated API? Is there some way I can dump the contents of the JSON to help debug?

kenliu commented

Confirmed that this is a bug, running latest master.

kenliu commented

This looks to be a bug in the response coming from the Todoist API.

The "user_id" field is returning as an integer instead of a string as in their API documentation. https://developer.todoist.com/sync/v9/#get-all-completed-items

I think for now the best course of action is to wait a few days for Todoist to resolve it on their end. I've opened a support ticket with Todoist to report this bug.

kenliu commented

BTW you can pass a --debug flag to todoist but unfortunately it does not log the response body so it doesn't help with troubleshooting an error in the JSON.

dasice commented

yeah it would be nice for the debug to dump the json in the case that there's an error, but it's not a big deal

kenliu commented

Got a response from todoist support. They said they are going to look into this and determine if the API change was intentional or not.

kenliu commented

@dasice I created #233 to add logging for the API response.

kenliu commented

@dasice todoist support says this is now resolved, it was a bug in their API that caused this.

UPDATE: We found the bug and made the correction now. The documentation was correct and so you should now be getting strings (and not integers) going forward.

dasice commented

Thank you, I can confirm that it works for me now, I really appreciate your upstream representation.