twitter-api-java-sdk icon indicating copy to clipboard operation
twitter-api-java-sdk copied to clipboard

tweets().searchStream().execute() throws 400 error with no response body if additional parameters are included

Open CallumWH opened this issue 2 years ago • 2 comments

TwitterApi.tweets().searchStream().execute() throws 400 error with no response body if additional parameters are included

Expected behavior

defining the call as

        Integer backfillMinutes = 1;
        OffsetDateTime startTime = OffsetDateTime.parse("2022-10-01T18:40:40.000Z"); // OffsetDateTime | YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Tweets will be provided.
        OffsetDateTime endTime = OffsetDateTime.parse("2022-10-14T18:40:40.000Z"); // OffsetDateTime | YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Tweets will be provided.
        Set<String> tweetFields = new HashSet<>(Arrays.asList("conversation_id", "author_id")); // Set<String> | A comma separated list of Tweet fields to display.

apiInstance.tweets().searchStream()
                    .tweetFields(tweetFields)
                    .backfillMinutes()
                    .startTime(startTime)
                    .endTime(endTime)
                    .execute();

enables the additional functionality of those fields within the searchStream.

Actual behavior

when .execute() is called, a 400 APIException is thrown with a null message body

Steps to reproduce the behavior

As per the code above will reproduce this error. It is also discovered that .tweetFields() does not trigger this error, as does excluding all optional fields.

CallumWH avatar Oct 12 '22 12:10 CallumWH

Thanks, I'll check it

zacmos avatar Oct 16 '22 21:10 zacmos

Hi, I'm not supporting this project since I'm not in the organization anymore.

Regarding your error, Look here how to get the error message.

The problem is with the parameter that relates to Academic Research access.

zacmos avatar Jan 23 '23 22:01 zacmos