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.
Solution: Cognitive Services API - Java Tutorial
From the course: Calling REST APIs with Java
Solution: Cognitive Services API
(upbeat music) - [Instructor] How did it go? Were you able to find a working solution? Let's take a look at how I chose to solve the problem. Now don't worry if your code doesn't match mine exactly, it's more about getting experience calling an API and working with Azure Cognitive Services. I've also added some bells and whistles in my example so that you can see more of the HTTP client interface. Okay, so I started off by building a TextDocument object and a TextAnalyticsRequest object. These are going to store the information that we're going to pass in the request body of the HTTP request, to the text analytics API. Now after I built those objects, I created the URI to the Azure Cognitive Services Sentiment endpoint. To do that, I concatenated the path to Version 3 of the endpoint, with the domain specific to my resource in Azure Cognitive Services. You can see that as a constant in the top of the class. Remember…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Azure Cognitive Services5m 40s
-
(Locked)
Text Analytics API registration and security7m 34s
-
(Locked)
Java HTTP Client9m 29s
-
(Locked)
Calling Azure Cognitive Services APIs7m 9s
-
(Locked)
Asynchronous API calls6m 50s
-
(Locked)
Challenge: Cognitive Services API3m 25s
-
(Locked)
Solution: Cognitive Services API4m 54s
-
-
-
-