Solved

Using FME to call Power BI via the API to refresh data sets dynamically. I am stuck with the authentication piece for the Bearer token.

  • 23 March 2021
  • 8 replies
  • 71 views

In this article - Woody describes a custom HTTP caller using a parameter to call PBI API. Idea: Power BI Writer (safe.com), I don't really need a writer, I am looking for a way to use the HTTP caller and liked the post about using parameters.

I have followed Microsoft's instruction for registering an APP. I can use MS docs to call the API to refresh a dataset. I have done the same with Postman. I am stuck trying to do the same with FME.

Thank you - Tim Woods

icon

Best answer by virtualcitymatt 23 March 2021, 20:07

View original

8 replies

Userlevel 4
Badge +26

Hmm, if you can do it in postman then you're really close to get it working with httpcaller​. You should be able to use the token in one of the header fields. You just need to make sure that the header name and value is using the correct syntax. The header name is probably "Authorization" and the value will be something like "token=<yourtoken>" or "Bearer <token>".

What have you tried so far. Can you share a screenshot from postman?

Many thanks, I think I see what you are talking about. I have attached the image as requested. I will give this a try to see if I can make that work. Thank you.

Adding the header as suggested solve the problem I was having. Thank you again.

Badge +2

@timothy.woods​ 

 

This would be easy to set up as a web connection too. Somewhere on my computer I have the definition saved that I just need to upload to FME Hub, but when it's done you'd be able to enter in the details from your app, create a web connection and use that in the HTTP Caller (should make things easier and will auto refresh the token for you).

You might have already received this on live chat - did it work for you?

 

 

@jlutherthomas -If you can point me to the web connection you mention, I will give that a try. In my testing, I used a token that was generated from the MS Documentation (try it) area. The token will and did expire. The next step for me is to use something like you describe where I get a token or refreshes the token as you describe in the web connection. Thank you.

Badge +2

@timothy.woods​ 

Try what I uploaded.

In FME Options > Web Connections > Manage Web Services > Import from file

Then go back to web connections > new web connection > Power BI > enter credentials.

 

This web connection was based on this blog and adapting it for FME.

You will need to register an app in Azure to get the client ID and secret.

@jlutherthomas​ 

Many thanks for your help with this. The Web connection did work finally. I wanted to share this with anyone else that there is a setting in Azure that was required in order for me to get Postman & FME to work properly.

Since I do not have Admin level access in Azure, I worked with my admin to make sure this setting was selected when registering the app and granting API permissions.

Within the API permissions if the (Grant admin consent for <your company> is grayed out, ask the admin to select this option for you. Once selected the status under permissions will have a green checkmark and indicate this is granted for <your company>.

Without this setting the Postman error would be "error": "invalid_grant", "error_description"; "AADSTS65001" The user or administrator has not consented to use the application with ID ".....

In FME, the web connection will throw and 404 error

Once the setting has been made in Azure, Postman will return the token and FME will execute the call to the Power BI API.

Screenshot provided of setting in Azure.

Thank you again to everyone who provided feedback and suggestions.

 

I see you're trying to use FME to call Power BI via the API to refresh data sets dynamically. I'm not an expert in this area, but you're close to getting it working. I've discovered some training courses about power bi data analyst that cover those topics. So, as far as I know, if you've succeeded with Postman, you should be able to use the token in one of the header fields with FME's httpcaller.Regarding the authentication piece for the Bearer token, have you tried using the header name "Authorization" and the value "Bearer <yourtoken>"? This is a common way to include authentication information in API requests.Also, I've noticed that you mentioned Woody's article about using a custom HTTP caller with parameters. That sounds like an interesting approach, and I hope you're able to make progress with it.By the way, I'm new to this forum, and I've been hunting for similar information. I've

Reply