From the course: Calling REST APIs with Java

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Calling Twitter Streaming API with Spring WebClient

Calling Twitter Streaming API with Spring WebClient - Java Tutorial

From the course: Calling REST APIs with Java

Start my 1-month free trial

Calling Twitter Streaming API with Spring WebClient

- [Instructor] We're going to use another unit test to practice some calls to the Twitter streaming API. Now, a couple things about this demonstration. You'll notice that we have injected the TWITTER_BEARER_TOKEN from an environment variable, so you want to make sure that's configured on your system. And then you'll see these three constants: the Twitter API domain, the stream endpoint, and the stream rules endpoint. We're also going to be doing things a little bit different with our WebClient. You'll notice that I've autowired in a builder for the WebClient from Spring. And the reason we're doing this is because when you inject the builder from Spring, you get some preconfigured codeX and other configurations by default that make it easier to work with the builder. Okay, so all that's in place, let's start building out our call. The first thing we'll need is an instance of the WebClient, so we're going to use the builder.…

Contents