Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an IllegalArgumentException when deserializing JSON response to create tweet #61

Open
broadbear opened this issue Jun 22, 2023 · 0 comments

Comments

@broadbear
Copy link

Getting an IllegalArgumentException when deserializing JSON response to create tweet. It looks like the TweetCreateResponseData class doesn't contain fields present in the create tweet response JSON since Sept 20, 2022:

https://developer.twitter.com/en/docs/twitter-api/fields

By default, the Tweet object only returns the id and the text fields, and for Tweets created since September 29, 2022, the edit_history_tweet_ids field.

Expected behavior

CreateTweetRequest instance is created and populated with tweet information from the JSON response to create a tweet.

Actual behavior

Getting an IllegalArgumentException when deserializing JSON response to create tweet. The error seems to be related to a newish JSON field that was added to the response to create tweets via the TwitterApi.tweets().createTweet() api call. The exact error is:

java.lang.IllegalArgumentException: The field edit_history_tweet_ids in the JSON string is not defined in the TweetCreateResponseData properties. JSON: {"edit_history_tweet_ids":["1671964017076883456"],"id":"1671964017076883456","text":""Ahoy!""}

Steps to reproduce the behavior

Use the twitter api to create a tweet and attempt to deserialize the response directly to a TweetCreateResponse object.

TweetCreateResponse result = apiInstance.tweets().createTweet(createTweetRequest);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@broadbear and others