Skip to main content
Question

How to get Token (Bearer) code to use for connect API?


laila72
Contributor
Forum|alt.badge.img

I am a GIS engineer who wants to learn how to access data via API. I have tested a bit and managed to connect to simple APIs. Now trying to connect to a Swagger API and can't get the token to connect to the API. I have received a key and can access via website if I enter code under Authorize. I want to connect to the API using FME, but do not know how to access the token code. Can anybody help me?

PowelMeldingAuthorizations

7 replies

hkingsbury
Celebrity
Forum|alt.badge.img+53
  • Celebrity
  • March 28, 2021

In the httpcaller, you needs to specify an Authorization Header with the name "Authorization" and the value "Bearer <token>"

 

 


laila72
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • April 6, 2021

TokenThank you, and sorry for late response, I have been on vacation. I don't have token value, just a key(value) to use for getting token value. Am I wrong thinking I have to first get token value and use this code in Authoizatin Header, like you showed me, with the token code after Bearer?

 


kailinatsafe
Safer
Forum|alt.badge.img+21

Hello @laila72​ , it may be possible to build a web service and then use FME to connect to it without manually obtaining the token. Is there any API documentation (specifically on authorization or authentication) available for this? We have some resources on web services here: https://community.safe.com/s/article/Web-Connections-and-FME. Hope this helps, Kailin


hkingsbury
Celebrity
Forum|alt.badge.img+53
  • Celebrity
  • April 6, 2021
laila72 wrote:

TokenThank you, and sorry for late response, I have been on vacation. I don't have token value, just a key(value) to use for getting token value. Am I wrong thinking I have to first get token value and use this code in Authoizatin Header, like you showed me, with the token code after Bearer?

 

Yes, you need to generate that token somehow. I've had a quick look at what i think is the REST API (https://meldingapi.powel.net/swagger/index.html?urls.primaryName=Powel%20Melding%20API%20v2) and there doesn't seem to be any call exposed to enter credentials and generate a token. If you have a user name and password you could try using basic authentication in the HTTP Caller (under Use Authentication). If that doesn't work, i'd touch base with the API provider for some help


laila72
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • April 19, 2021

Thank you both :-) No I found some more information. I can access date using powerB (web connection), but the same parameters in web connection FME don`t work. Any idea why?

WebConnection


hkingsbury
Celebrity
Forum|alt.badge.img+53
  • Celebrity
  • April 19, 2021
laila72 wrote:

Thank you both :-) No I found some more information. I can access date using powerB (web connection), but the same parameters in web connection FME don`t work. Any idea why?

WebConnection

Thats the interface to build a WebConnection, you need to use a HttpCaller


laila72
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • April 20, 2021

Hi again, and thank you for your answer. I got access with HTTPCaller, the solution is username en key value in the header. GetData


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings