Which Twitter API Endpoints Does Blash Use?

Blash uses a number of Twitter API endpoint's to be able to display tweets based on a dashboard.

From being able to set up different rules, to showing tweets based on a particular search query.

Blash also uses the Twitter API to show tweets in real time.

That's have a look at what Twitter API endpoints that Blash uses.

Cap Usage

Before we do, it's worth noting about the monthly cap usage.

All Twitter API endpoints have some sort of limit as to how often you can call them.

And the same goes when you use a project within your Twitter Developer account.

So if you set up a dashboard which returns a lot of tweets, bare in mind that your limit is going to shrink rapidly!

OAuth Security

Blash uses version 2 of the Twitter API.

This allows it to use a bearer token for OAuth security.

It's this version of the API that Blash is using.

Blash uses the OAuth2 bearer token endpoint to generate a bearer token every time it calls one of the Twitter API endpoints.

It passes in the client ID and secret as part of the request using basic authentication. From there, a bearer token is generated.

It's this bearer token that can be used to access the different Twitter API endpoints.

Rules

Within each app in a Twitter Developer account, you can set up rules.

Rules are a list of Twitter search queries stored against a particular Twitter Developer app.

The main purpose is to retrieve real-time tweets from these rules when connected to the filtered stream endpoint.

When the Blash API starts up, it retrieves a list of all the different rules, and stores them as dashboards in it's database.

Blash also allows you to add, or delete a dashboard. These actions communicate with the Twitter API, so both the rules and the dashboards sync up together.

Recent Tweets

The Twitter API allows you to search for tweets that have been published in the last seven days.

With the recent tweets endpoint, you can do just that. In addition, you can search for tweets on different queries, such as the start or end date.

You can also specify the number of results that are returned.

When Blash starts up, it goes through all the dashboards, and uses each dashboard query to get the most recent tweets.

This is to ensure that dashboards already have tweets displayed when Blash is initialised.

Filtered Stream

The final endpoint that Blash uses is probably the most important of them all.

The filtered stream endpoint allows you to retrieve real-time tweets based on the rules you've set up on your app.

What Blash does is that it keeps a constant connection to the filtered stream endpoint.

When the filtered stream returns a tweet, the Blash API stores the tweet in it's database, and SignalR sends that tweet to it's Blazor WebAssembly application.

It's from there that the tweet is displayed on the dashboard to the user.

Subscribe to our YouTube Channel

  • Free ASP.NET Core coding tutorial videos.
  • Implement a how-to guide on a topic related to ASP.NET Core.
  • Covers Blazor, Web API's, SQL Server, EF and many more...
Subscribe