Skip to content
Advertisement

How can I get api with FeignClient

I used Lombok, Open Feign and Spring Web

I have currencyClient interface:

JavaScript

And Controller:

JavaScript

And “http://localhost:1212/getAllCurrency” is not working cause the link is converted into “**https://openexchangerates.org/api/historical/2012-07-10.json/appId**” I understand that &/= are reversed and I also think that my indication of List is not correct. That’s what I tried so how can I get info from “**https://openexchangerates.org/api/historical/2012-07-10.json?app_id**” as “http://localhost:1212/getAllCurrency“?

Advertisement

Answer

According to the https://docs.openexchangerates.org docs, the app_id should be a request parameter (see @RequestParam), not a path variable. You could do something like this:

CurrencyClient interface:

JavaScript

StatusController:

JavaScript

Some additional things to note here:

Please don’t post yout API key to StackOverflow, or anywhere else publicly. Other people might abuse it. Since you already posted it, you should request a new API key and get rid of this one (close it if possible).

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement