• Home /
  • Articles /
  • Search API Video Walkthrough

  • Search API Video Walkthrough

    posted on 25 March 2014 by Leah Barren


    If you are getting acquainted with the Search API, check out the following video. You’ll be introduced to the high-level functionality, and get everything you need to connect quickly.

    This document provides a step-by-step introduction to Gnip’s Search API, and offers simple examples of how to get started making requests to the Gnip Search API, including:

    • Data requests - Full Twitter payloads
    • Counts requests - The number of Tweets that match a query

    The examples shown utilize a data transfer tool called curl, which comes natively on mac and linux systems.


    Data requests 

    Data requests provide full Tweet results from the last 30 days that match the query specified with the request. For details on the types of queries supported, see the documentation here.

    To execute a Data request:

    1. Navigate to the Search API page on the dashboard at console.gnip.com
    2. Under “Data Request”, copy one of the curl commands (either the GET request or the POST request) shown
    3. Paste this into a command-line prompt, modify the query portion of the command (if desired), and execute it

    This will return a JSON payload containing recent Tweets that match your query. See the full documentation for details on the other parameters supported in these requests.

    The Tweet payloads returned by the Search API are provided in Gnip’s JSON Activity Streams format as described here, or in Twitter’s native format.


    Counts requests 

    Counts requests provide the number of Tweets matching the specified query. These counts can col-md- up to the last 30 days, and can be defined in day, hour, or minute buckets.

    To execute a Counts request:

    1. Navigate to the Search API page on the dashboard at console.gnip.com
    2. Under “Counts Request”, copy one of the curl commands (either the GET request or the POST request) shown
    3. Paste this into a command-line prompt
    4. If desired, modify the query and bucket (day, hour, or minute) parameters in the command, and execute it

    The API will return a JSON payload that indicates the time buckets requested, and the number of matching Tweets that fell within that time period.