0

I have a domain name enrichment task. I want to make a make a GNIP query using REST. Here's what I want to do:

Make a query to gnip containing a shortened url eg/"http ow.ly4eyW50fy4eP Then use a gnip rule (maybe 'url_contains') to get the expanded url.

I am new to gnip, but I understand I can use the search api.

I'm having trouble finding a Java simple tutorial/'hello world' example for making gnip queries using rest :(

I found the rule 'url_contains' here:: http://support.gnip.com/apis/search_api/rules.html

And example REST requests here: https://github.com/gnip/support/tree/master/Search%20API/Java

But nothing specifically on how to apply a gnip rule to a rest request.

I'm guessing the query might look like this (curl).

curl -X POST -u <me>   
"https://search.gnip.com/accounts/me/search/prod.json -d '{
"rules": [
  {
    "value": "url_contains:bla"
  }
 ]
}'

So my first question is, does this request look ok?

And if not, could anybody help me with an example? Or perhaps signpost me to an example online?

Johnny Alpha
  • 758
  • 1
  • 8
  • 35

1 Answers1

0

Ah! The answer is in the PostRequest.java class here ::

https://github.com/gnip/support/tree/master/Search%20API/Java

and no rule is required, the shortened url simply needs to be present in the payload as shown here::

http://support.gnip.com/enrichments/expanded_urls.html

Johnny Alpha
  • 758
  • 1
  • 8
  • 35