Getting started with the filtered stream endpoints
This quick start guide will help you make your first request to the filtered stream endpoint group using a cURL request. cURL is a command line tool which allows you to make requests with minimal configuration. If you would like to see sample code in different languages, please visit ourX API v2 sample code GitHub repository.PrerequisitesTo complete this guide, you will need to have a set of keys and tokens to authenticate your request. You can generate these keys and tokens by following these steps:
- Sign up for a developer account and receive approval.
- Create a Project and an associated developer App in the developer portal.
- Navigate to your App’s “Keys and tokens” page to generate the required credentials. Make sure to save all credentials in a secure location.
Steps to build a filtered stream request using cURL
Step one: Create a rule Rules are made up of one or many different operators that are combined using boolean logic and parentheses to help define which Posts will deliver to your stream. In this guide, we will filter the stream to find Posts that contain both the keyword “cat” and images. Here is our rule:has:images
with images
- The additional tweet.created_at field in the primary Post objects.
- The associated authors’ user object’s default fields for the returned Posts: id, name, and username
- The additional user.created_at field in the associated user objects.
Key | Value | Returned fields |
tweet.fields | created_at | tweets.created_at |
expansions | author_id | includes.users.id, includes.users.name, includes.users.username |
user.fields | created_at | includes.users.created_at |