Hey Jessica,
Sorry for the delay, had to get back on my personal computer. So here is the url I’m calling:
public static String FULL_ARCHIVE_URL = "https://api.twitter.com/1.1/tweets/search/fullarchive/dev.json";
And here is the code that builds my requests:
public MyQueryRequest buildQuery(String screenname) throws MyServiceException{
if(StringUtils.isEmpty(screenname)) {
//TODO: log and throw an error
}
MyQueryRequest req = new MyQueryRequest();
String q = req.getQuery();
q = q.concat("(");
List<Word> words = wordsRepository.findAll();
Iterator iterator = words.iterator();
Word nextWord = (Word) iterator.next();
while(iterator.hasNext()) {
q = q.concat(nextWord.getText()).concat(" OR ");
nextWord = (Word) iterator.next();
}
//for the last word, don't add 'OR'
//also add the 'from'
q = q.concat(nextWord.getText()).concat(") ");
//append fund operator
q = q.concat(buildFromOperation(screenname));
if(q.length() > 1024) {
throw new MyServiceException("Query is too long, user's screenname should not be this long..");
}
req.setQuery(q);
return req;
}
I just tested this locally, and I attached the query that this code produced. For purposes of testing this again, I modified the first two words I’m searching for to ‘honk’, and ‘commuting’, and I searched my own Twitter history. I used these (both sadly about driving) because I used tweeted the word ‘honk’ a few days ago, and tweeted about ‘commuting’ in 2016.
Honk: https://twitter.com/nicky_robby/status/1172614123760365569
‘Commuting’: https://twitter.com/nicky_robby/status/781830976561438720
After calling the endpoint, I get a 200 successful response, and can see only the ‘honk’ instance returned.
Here is the full value of the query I’m sending in MyQueryRequest:
(honk OR commuting OR Apricot OR Avocado OR Banana OR Bilberry OR Blackberry OR Blackcurrant OR Blueberry OR Boysenberry OR Currant OR Cherry OR Cloudberry OR Coconut OR Cranberry OR Cucumber OR Damson OR Date OR Dragonfruit OR Durian OR Elderberry OR Feijoa OR Fig OR Goji OR Gooseberry OR Grape OR Raisin OR Grapefruit OR Guava OR Honeyberry OR Huckleberry OR Jabuticaba OR Jackfruit OR Jostaberry OR Jujube OR Kiwifruit OR Kumquat OR Lemon OR Lime OR Loganberry OR Loquat OR Longan OR Lychee OR Mango OR Mangosteen OR Marionberry OR Melon OR Cantaloupe OR Honeydew OR Watermelon OR Mulberry OR Nectarine OR Nance OR Orange OR Clementine OR Mandarine OR Tangerine OR Papaya OR Passionfruit OR Peach OR Pear OR Persimmon OR Plantain OR Plum OR Prune OR Pineapple OR Pineberry OR Plumcot OR Pomegranate OR Pomelo OR Purple) (from:nicky_robby)
Here is the body I recieved
{"results":[{"created_at":"Fri Sep 13 20:52:47 +0000 2019","id":1172614123760365569,"id_str":"1172614123760365569","text":"Firing off a nice justified honk of the horn is one of life\u2019s purest pleasures","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":15362686,"id_str":"15362686","name":"Nick","screen_name":"nicky_robby","location":"philadelphia","url":null,"description":null,"translator_type":"none","derived":{"locations":[{"country":"United States","country_code":"US","locality":"Philadelphia","region":"Pennsylvania","sub_region":"Philadelphia County","full_name":"Philadelphia, Pennsylvania, United States","geo":{"coordinates":[-75.16379,39.95234],"type":"point"}}]},"protected":false,"verified":false,"followers_count":714,"friends_count":834,"listed_count":12,"favourites_count":10935,"statuses_count":6379,"created_at":"Wed Jul 09 05:39:47 +0000 2008","utc_offset":null,"time_zone":null,"geo_enabled":true,"lang":null,"contributors_enabled":false,"is_translator":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":true,"profile_link_color":"0084B4","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/995804535649177600\/rOmal_WS_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/995804535649177600\/rOmal_WS_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/15362686\/1535718829","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"quote_count":0,"reply_count":1,"retweet_count":0,"favorite_count":4,"entities":{"hashtags":[],"urls":[],"user_mentions":[],"symbols":[]},"favorited":false,"retweeted":false,"filter_level":"low","lang":"en","matching_rules":[{"tag":null}]}],"requestParameters":{"maxResults":100,"fromDate":"201908180000","toDate":"201909172324"}}
Any help on this or see something I’m doing wrong? Sorry for the lengthy response and thanks in advance for the help