1. Introduction In projects we often have some integrations with API layer of 3rd party systems. This means that on our side we need to prepare HTTP client to be able consume those endpoints. Based on API specification we need to prepare Resource representation classes. Then, HTTP client with some configurations, like headers, timeouts, error handling. Parse request and response payloads into objects and many other things. All off this on the end creates a lot of boilerplate code. Inspired with my latest project I want to introduce Feign HTTP client. Feign is HTTP client which goal is to simplify writing HTTP clients. Goal is to reduce complexity of REST API integrations. With Feign we need to declare and annotate an interface based on API specification. And in background Feign will process annotations into a templated requests. Feign offers you to configure different HTTP clients, JSON/XML processors, metric providers, loggers and some other features. 2. Example Throughout this article, we will integrate Faker APIs in Adobe Experience Manager (AEM) project. Goal is to get some fake generated data about users and addresses. 3. Setup First, in your AEM project add needed dependencies. io.github.openfeign feign-core 11.0 io.github.openfeign feign-jackson 11.0 com.fasterxml.jackson.core jackson-core 2.12.0 com.fasterxml.jackson.core jackson-annotations 2.12.0 com.fasterxml.jackson.core jackson-databind 2.12.0 Besides the feign-core , additionaly we'll use feign-jackson for JSON processing. _ Feign-jackson _ requires jackson-core , jackson-annotations and _ jackson-databind _ dependencies.
Please use this thread to ask the related questions.
Views
Replies
Total Likes