{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"968221c5-6cab-4b0a-9991-af14d1381190","name":"Twitter (V2) (Labs)","description":"The [Twitter Labs recent search endpoint](https://developer.twitter.com/en/docs/labs/recent-search/overview) represents the future implementation of Twitter search endpoints.  This Labs endpoint provides developers API access to public Tweets posted in the previous seven days. Labs recent search is a RESTful endpoint that receives a single search query and responds with matching Tweets. Tweets are delivered in reverse-chronological order, starting with the most recent Tweets. The endpoint uses OAuth 2.0 Bearer Token authentication. \n\nUp to 100 Tweets are returned per request, and pagination tokens are provided for paging through large sets of matching Tweets. Search queries can be created with over 15 \"operators\" that match on Tweet attributes, such as message keywords, hashtags, and URLs. Operators and rule clauses can be combined with boolean logic and parentheses to help refine the filter's matching behavior. Queries can be up to 512 characters long.\n\nLabs recent search requests support the Labs fields and expansions parameters, and return the new Labs Tweet JSON design shared by the other Labs endpoints. \n\nLabs recent search supports navigating the Tweet archive by time ranges and Tweet ID ranges. Recent search is designed to support two common use patterns: \n\n- **\"Get historical\"**: Requests are for a period of interest, with no focus on the real-time nature of the data. A single request is made, and all matching data is delivered using pagination as needed. This is the default mode for Labs recent search.\n- **\"Polling\" or \"listening\"**: Requests are made in a \"any new Tweets since my last request?\" mode. Requests are made on a continual basis, and typically there is a use case focus on near real-time 'listening' for Tweets of interest. \n \nLearn more about these topics:\n\n- **Building search queries** - Labs recent search supports 15 operators that match on Tweet attributes. Queries can be short and simple or can be a complex set of filters with up to 512 characters. Building effective queries is an iterative process. \n- **Making search API requests** -  Labs recent search requests are made using the HTTP GET method and \"app-only\" (Oauth 2.0) authentication. See the Labs recent search Quick Start guide for help with making your first request. To learn more about request parameters, see the API Reference for more details.\n - **Pagination** - Since most search queries will match more Tweets than can be returned in an API response, the Labs recent search endpoint will split the data payload into multiple 'pages.' The endpoint supports simple pagination methods to assemble Tweets collections.\n \nThis is a standalone Postman collection dedicated just to the recent search endpoint, created by Postman in an effort to highlight the potential of this particular endpoint while reducing the cognitive load with anyone who is first putting this collection, or any derivative collection build from this collection. Making it easier to get up and running with the [Twitter Rececnt Search API](https://developer.twitter.com/en/docs/labs/recent-search/overview).\n\n## Twitter Developer Account\nBefore you can use this collection you will need to apply for a Twitter developer account, which is an extra step you can take using any existing Twitter account, over at [dev.twitter.com](https://developer.twitter.com).\n\n<img src=\"https://kinlane-productions.s3.amazonaws.com/postman-tutorials/twitter-recent-search-api/1-twitter-developer.jpg\" width=\"100%\" align=\"center\">\n\n## Apply For API Access\nIn an effort to address abuse Twitter requires developers to provide a significant amount of information about what they plan on building, making the one-time developer sign up process something that will take you a few minutes--[header over to dev.twitter.com and apply](https://developer.twitter.com/en/apply-for-access).\n\n<img src=\"https://kinlane-productions.s3.amazonaws.com/postman-tutorials/twitter-recent-search-api/2-apply-for-access.jpg\" width=\"100%\" align=\"center\">\n\n## Twitter Application\nOnce you have an approved Twitter developer account, you will need to create an application before you are given keys to actually begin making calls to the Twitter API. To [create a new application you need to head to the application area](https://developer.twitter.com/en/apps/create) within your Twitter developer account.\n\n<img src=\"https://kinlane-productions.s3.amazonaws.com/postman-tutorials/twitter-recent-search-api/4-add-application.jpg\" width=\"100%\" align=\"center\">\n\n## API Keys\nOnce you have completed the creation of your new Twitter application you can retrieve your API keys using the \"keys and tokensa\" tab, providing what you need to make this collection work.\n\n<img src=\"https://kinlane-productions.s3.amazonaws.com/postman-tutorials/twitter-recent-search-api/5-get-api-keys.jpg\" width=\"100%\" align=\"center\">\n<p align=\"center\"><strong><em>tokens displayed are not real</em></strong></p>\n\n## Twitter Labs\nBefore your keys will work you need to do one more thing, [join the Twitter developer labs program](https://developer.twitter.com/en/account/labs), and active the recent search API and associate with your Twitter developer account and application.\n\n<img src=\"https://kinlane-productions.s3.amazonaws.com/postman-tutorials/twitter-recent-search-api/6-twitter-developer-lab.jpg\" width=\"100%\" align=\"center\">\n\n## Postman Authentication\nNow that you have your keys you will have to add them to the environment for this Postman collection, connecting the dots between this collection and your Twitter application.\n\n<img src=\"https://kinlane-productions.s3.amazonaws.com/postman-tutorials/twitter-recent-search-api/7-add-to-environment.jpg\" width=\"100%\" align=\"center\">\n<p align=\"center\"><strong><em>tokens displayed are not real</em></strong></p>\n\n## Obtain Bearer Token\nWith your API keys entered into the environment for this collection you can use the \"Generate Authentication Token\" request to obtain and store the bearer token in the environment for this collection, allowing it to be used for making search requests.\n\n<img src=\"https://kinlane-productions.s3.amazonaws.com/postman-tutorials/twitter-recent-search-api/8-auth-token.png\" width=\"100%\" align=\"center\">\n\n## Twitter Recent Search\nNow the Twitter recent search endpoint should work for you, allowing you to adjust the query parameters to find exactly the search you desire. Using Twitter next generation search to make sense of any conversation occurring via Twitter.\n\n<img src=\"https://kinlane-productions.s3.amazonaws.com/postman-tutorials/twitter-recent-search-api/9-next-generation-search.png\" width=\"100%\" align=\"center\">\n\nIf you need further information you can visit [the Twitter Developer Labs Recent Search API (V2) documentation](https://developer.twitter.com/en/docs/labs/recent-search/overview). Hopefully this collection gets you what you need to make on-boarding with the Twitter recent search API easier.","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"10394726","team":279991,"collectionId":"968221c5-6cab-4b0a-9991-af14d1381190","publishedId":"SzYbxHEn","public":true,"publicUrl":"https://documenter-api.postman.tech/view/10394726/SzYbxHEn","privateUrl":"https://go.postman.co/documentation/10394726-968221c5-6cab-4b0a-9991-af14d1381190","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"documentationLayout":"classic-double-column","version":"8.10.1","publishDate":"2020-04-03T22:32:10.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[{"name":"Twitter (V2) (PUBLISH)","id":"3b5aadbb-794e-46f9-b5a5-2002e56c6f1f","owner":"10394726","values":[{"key":"api_key","value":"<your twitter api key>","enabled":true},{"key":"api_secret_key","value":"<your twitter api key>","enabled":true},{"key":"bearer_token","value":"[run auth method]","enabled":true}],"published":true}],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/ef425db5985b19d2e7b6d64e83c17a3ecde2b36d9a05fd7571ed72534ee2f9cf","favicon":"https://res.cloudinary.com/postman/image/upload/v1551137092/team/rby2skmk0tmcz0ygbvke.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"},{"label":"Twitter (V2) (PUBLISH)","value":"10394726-3b5aadbb-794e-46f9-b5a5-2002e56c6f1f"}],"canonicalUrl":"https://documenter.gw.postman.com/view/metadata/SzYbxHEn"}