'Access http servlet content in an API

I'm making a call to the test API (an API of a different application that I have created) using WebClient in spring boot.

The return type of the WebClient call to the test API is: ResponseEntity<String>

In the test API, I'm accessing and setting some values to the HttpServletResponse and returning the same in the response. I want to access the same content from the Http servlet response in the current API call.

How can I do that?



Solution 1:[1]

  1. Find the URI of the external server or program.

To make an API call, the first thing you need to know is the Uniform Resource Identifier (URI) of the server or external program whose data you want. This is basically the digital equivalent of a home address. Without this, you won’t know where to send your request.

It’s important to note that most APIs have different endpoints, each with their own end paths. For example, let’s say you want to stream public tweets in real-time. Then you could use Twitter’s filtered stream endpoint. The base path, which is common to all endpoints, is https://api.twitter.com. The filtered stream endpoint is /2/tweets/search/stream. You can either add that to the end of the base path, or just list the endpoint in your request.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Arman-