Status code: 422 when trying to build query with premium search operators



I’m trying to get tweets related with grip ( means flu in turkish) I’m using pyton wrapper for this.I’ve build a query rule like this. But it’s returning “retrying request; current status code: 422” what am I doing wrong here? I have premium subscription so it’s not a sandbox environment. So I can use -has:links and -is:retweet operators cause I don’t want retweets and tweets with links . Here is my query rule;

rule = gen_rule_payload("grip lang:tr AND -has:links AND -is:retweet", results_per_call=500, from_date=2018-02-20, to_date=2018-02-21)

Also I’ve tried like this;

rule = gen_rule_payload("(grip) (lang:tr) -(has:links AND is:retweet)", results_per_call=500, from_date=2018-02-20, to_date=2018-02-21)

I’m sure that I’m missing something but what? Thanks for any help.

Best Regards.


Ok, I found that logical operator AND doesn’t work with premium search or I am doing it wrong. This rule is working and not giving error;

rule = gen_rule_payload("grip lang:tr -has:links -is:retweet", results_per_call=500, from_date=2018-02-20, to_date=2018-02-21)

It is filtering out retweets.But it doesn’t filtering out tweets with links. I wonder if we can negate has:links or not.

Also when I want to filter out replies this rule is giving error too;

rule = gen_rule_payload("grip lang:tr -has:links -is:retweet -is:reply", results_per_call=500, from_date=2018-02-20, to_date=2018-02-21)

Can’t we use is:reply in premium search? Is there anyway to filter out replies,retweets and tweets with links together?

By the way I’m using full archive search endpoint and I’m using


Hi @AlpayKurbal - what’s the full error message you’re seeing when attempting to run this search request?



It’s giving below error. Is there a way to get full error message that I don’t know? Because I’m just getting status code 422 which refers to Unprocessable Entity.

Grabbing bearer token from OAUTH
{“query”: “grip lang:tr -has:links -is:retweet -is:reply”, “fromDate”: “201802050000”, “toDate”: “201802060000”, “maxResults”: 500}
retrying request; current status code: 422

Best Regards