Twitter defines its platform as "what's happening in the world and what people are talking about right now."

You've got to be on Twitter to understand the strength of this statement. According to the company's Q3 2020 report,1.87亿人use the platform daily and 330 million use it at least once a month.

Download Now: How to Use Twitter for Business [Free Kit]

The amount of data that can be generated by such a large population is enough to make any forward-thinking marketer interested in accessing Twitter's API.

Luckily, that's not impossible, nor is it difficult. However, to maximize the use of it, you have to understand how to apply these insights to your business.

But first, it’s worth understanding why marketers are so interested in accessing the Twitter API.

API stands for应用程序Programming Interface。该软件在两bob电竞官方下载个想要相互通信的应用程序之间提供了“中间人服务”。您提出的任何请求首先转到服务器,而给出的响应通过相同的路线。

这弥合了两个应用程序(手机和公司软件上的一个应用程序)之间的差距,同时提供了额外的安全性。bob电竞官方下载bob全站app例如,每当您使用社交媒体应用程序时,都可以与API进行交互。没有彼此直接接触,一个人对另一个构成的任何潜在威胁都会减轻。

An API also provides a list of commands that can be executed. To use a popular analogy, imagine you're ordering food at a restaurant. You're at the table, ordering from the kitchen. The link between you and the kitchen is the waiter who ensures that the kitchen staff gets all the orders and meals are delivered to the right customers. You're also free to ask them what's available before making your order.

Without the waiter, you'd be pushing your way into the kitchen yourself, trying to get something to eat. That’s where the API plays its role as the middle man between two pieces of software.

The API provides a list of methods the two applications can use to communicate. They include:

  • 获取检索数据。
  • POST for creating data.
  • 放置用于更新数据。
  • 删除删除数据。

Twitter API HTTP Methods and Endpoints

As an example, let’s take a look at the methods you would use to post, retrieve, and engage with Tweets.

The Twitter API uses two HTTP methods for retrieving Tweet data: GET and POST.

List of Twitter API endpoints for retrieving Tweets

图像源

Be careful: these endpoints will look different depending on what you want to do, so be sure to检查文档

For example, if you want to retrieve a Tweet timeline, the endpoints will look as follows:

检索时间表的Twitter API端点列表

图像源

Features of the Twitter API

Aside from the endpoints, let’s take a look at some of the salient features of Twitter's API:

  • There are four main objects: Tweets, Entities, Places, and Users.
  • There are daily restrictions: Calls and changes in the API are restricted by access tokens to protect the platform from abuse.
  • It is based on HTTP (rather than SSL).
  • There are specific measures to adapt the API operation to the social network including library restrictions, generated paging, and specific parameters.

Twitter API花费多少?

Twitter API有三个订阅软件包:标准,高级和企业。标准是完全免费的,comes with all the features you needto start using the Twitter API.

If you’re looking for more functionality, such as access to Twitter’s full archive, you’d want to go for a Premium subscription. The企业层对于那些想使用Twitter数据为其他企业提供广告系列管理或Twitter管理服务的人来说,是最好的。

您可以使用Twitter API做什么?

您可以做各种与检索,查看,分类和过滤Twitter上的数据有关的事情。

For example, you can:

Ready to get started? Let’s go over how you can use Twitter’s API step-by-step.

这是这个过程的样子,详细说明:

1.打开命令提示符终端。

在安装任何内容之前,请确保您熟悉如何打开终端。

On Mac: Go toFinder>应用程序s>Utilities>Terminal。或者,打开Spotlightby pressingCMD+空间并搜索“终端”。

On Windows: OpenCommand Promptby going to开始和searching for "cmd".

Microsoft stopped mainstream support for Windows 7 in January 2020. But if you're on that or older, use开始>所有程序>Accessories>Command Prompt

2。打开一个Twitter开发人员帐户。

To proceed, you need to have a Twitter developer account. Tocreateone, open the应用管理页面并创建一个应用程序。命名,输入网站URL,并提供100个字的描述。

3。Install Ruby, then launch Twurl.

To run Twurl, you'll need Ruby. So, make sure tohave it installed。然后,按照Twitter的tutorialsto install Twurl.

4。Create an API key.

To send API calls, Twitter assigns a unique set of keys to your developer account. To access them, login to your developer account and select细节from yourapps management screen

点击Keys and Tokensto generate a new, unique, and secret API key. Copy the secret and consumer API keys.

5.授权您的Twitter应用程序和帐户。

Run the following command in your terminal to authorize your Twitter app and account:

Twitter API command to authorize your Twitter account

Note: replacewith your API keys.

最后,将返回的URL复制并粘贴到您的浏览器中以获取PIN。然后,将销钉输入您的终端。

你们现在都设置了。有关更多信息,请查看Twitter的指南authentication

一旦您访问TwitterPI, you'll be able to perform user activities, such as sending messages and media without having to open the application. By using command-line tools likeTwurl卷曲, you’ll find more efficiency than you would by using the application directly.

使用命令行工具,您可以使用对Twitter API的访问来执行各种任务。Twurl是这项工作的最佳工具之一。它像卷发一样构建,但已针对Twitter API进行了专门修改。

Run thetwurl -hcommand to learn more about using Twurl. For a simple tutorial, runtwurl -TorTwurl-教程

Then, when you’re ready, below are some ideas for how to use the Twitter API.

Send a tweet.

您可以使用新设置来使用statuses/updatePOST endpoint. Twitter’s文档说这“更新了身份验证当前用户的状态”(即发送推文)。

Upload a media file.

使用Twurl,您还可以上传:

  • Images up to 5MB
  • GIF最多15MB
  • Videos up to 15MB

使用media/upload endpointas follows:

Twitter API media upload endpoint code

Respond to a tweet.

To respond to a tweet, use thestatus/update端点,就像您发送新推文一样。

在特定主题标签下检索推文。

要使用特定主题标签检索所有推文,请使用搜索/推文获取终点。默认情况下,结果返回推文以前7天发送。

您可以使用此功能来评估过去的营销活动 - 您或另一家公司的营销活动。bob全站app通过访问特定主题标签下共享的所有推文,您可以学到很多有关您的信息target audience, including the general mood around the topic.

查找本地趋势主题。

Find out what people in your locale are buzzing about. Use the趋势/地点获取终点。You'll need to provide the Yahoo! Where On Earth ID (WOEID) for your location — useWOEID Lookup找到你的。

Once you know the trending subjects for your audience, you can decide如何使用讨论to promote your brand.

Create bots.

If you want to venture deeper into the world of the Twitter API, you can use all of these and other endpoints to create bots. Then, they can share specific content, show live updates about a particular topic, and remind your staff and followers of an event — among other things.

G2shares a useful resource to get your feet wet with Twitter bots.

Now, let’s take a look at some Twitter API examples so that you can see how it all applies in the real world.

1。TweetBot

Tweetbot,由Tapbots, uses Twitter’s API to provide a seamless, ad-free experience for Twitter users. The timeline is also chronological rather than algorithm-based, and you can make private notes on people’s profiles, a feature not currently offered by Twitter.

TweetBotuses the following functionalities:

2。Twitter’s TweetDeck

Tweetdeck曾经是与Twitter的单独属性,但是was acquired by the social media giant in 2011。While it’s inseparable from its parent brand, TweetDeck is worth mentioning because it uses the Twitter API to function as a dashboard with full functionality.

What makes it different? You can see notifications, tweets, and trending topics all at the same time. Additionally, you can change the columns for a completely personalized experience.

TweetDeck使用所有Twitter API功能。您可以通过此Web应用程序发布推文,创建集合,发送DMS等。

3。Tweetmap

OmniSci’s Tweetmap is one of a handful of web apps that shows location-based Tweets. This web app can be used to determine which hashtags are trending where.

TweetMap使用以下功能:

4。小鸟的Twitter

小鸟的Twitteris a one-of-a-kind app that combines both news articles and Tweets from reputable news sources. You can read news articles within this app after clicking on a link on your timeline.

小鸟的Twitteruses the following functionalities:

5。Twitterrific

Twitterrificis for those who get overwhelmed by the sheer volume of information and Tweets in the original Twitter app. You can mute hashtags, phrases, and words. Like in the TweetBot app, the timeline is also chronological, and there are no sponsored tweets.

Twitterrificuses the following functionalities:

6.Chirp for Twitter

Chirp for Twitter is an Apple Watch app that’s specifically designed for use on the device’s small screen. Currently, you can post and read Tweets, as well as view and send direct messages.

Twitter的CHIRP使用以下功能:

7.Tweetagramby Bannerbear

Tweetagramis a handy tool for creating graphics out of notable Tweets. Simply input the link of a Tweet, and the tool will create several graphics for you to choose from:

Tweetagramuses the following functionality:

这些只是现实世界Twitter API用例的示例中的一些示例。Twitter也有合作伙伴列表bob综合博彩下载who use its APIs to offer Twitter marketing, analytics, and data management services. If you’re an agency or SaaS business, Twitter APIs could help you develop a new offering for your customers.

使用Twitter API来发展您的品牌

您可以使用Twitter API来构建客户会喜欢或加强Twitter参与度的应用程序。总体而言,Twitter是与观众沟通和学习的好地方。通过访问Twitter API,您可以通过深入的客户(甚至竞争对手)分析来修复营销。

编者注:该帖子最初于2020年3月发表,并已更新以进行全面性。

New Call-to-action

新的呼吁行动

Originally published Feb 5, 2021 7:00:00 AM, updated June 21 2021

主题:

应用程序Programming Interface (API)