Question

Set up the HTTP Caller to extract data from rest API

  • 27 December 2023
  • 2 replies
  • 28 views

Badge

Hi!

I am trying to get data (exchange rates) via a Rest API. I am a very beginner in using Rest API:s.

By now, I start with a creator and connect than the HTTP Caller. However, I have difficulties to set up the HTTP Caller and get a connection.

I use the following url:

https://api.riksbank.se/swea/v1/Observations/SEKEURPMI/2022-01-01/2022-12-31 HTTP/1.1

 

The API needs a so called Ocp-Apim-Subscription-Key. It contains of 32 numbers and letters.

I guess this should be defined in the header, but how would I do this in FME? There is no such parameter available, is it?

To access the API portal username and password are required. Do I have to use this username and password in the "Use Authentication" section or does it refere to the username and password of the API itself?

 

Thank you so much in advance.

 

grafik


2 replies

Userlevel 6
Badge +34

What is not working? What does the log say? What kind of error message do you see in the feature from the rejected port?

 

You did enter the key in the header as I would do it. I believe this is correct. Do you have documentation from the API what they expect? POST or GET, type of request etc.

 

The general advice is to get it working in a tool like Postman and then transfer the configuration to the HTTPCaller. This works more intuitive and will give better feedback.

Badge

What is not working? What does the log say? What kind of error message do you see in the feature from the rejected port?

 

You did enter the key in the header as I would do it. I believe this is correct. Do you have documentation from the API what they expect? POST or GET, type of request etc.

 

The general advice is to get it working in a tool like Postman and then transfer the configuration to the HTTPCaller. This works more intuitive and will give better feedback.

Thank you very much for your help! I tried with Postman as you suggested and got to work it from there. Thanks for this tip.

The following was wrong/missing:

The url I used was not correct. I should have deleted the HTTP/1.1 snippet. Besides, in FME it was sufficient to only use the API key in the header, I did not need to specify any additional authentification in the HTTPCaller

Reply