cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SlavaSha7
Helper I
Helper I

Error getting token for external web API (RingCentral)

I would like to get data from RingCentral to Power BI via eb API using M.

I was able to get token using Postman but I get error on Power BI with the same credentials

 

DataSource.Error: Web.Contents failed to get contents from 'https://platform.devtest.ringcentral.com/restapi/oauth/token' (404): Not Found
Details:
DataSourceKind=Web
DataSourcePath=https://platform.devtest.ringcentral.com/restapi/oauth/token
Url=https://platform.devtest.ringcentral.com/restapi/oauth/token

 

This is my M code:

let
    authKey = "Basic " & Binary.ToText(Text.ToBinary("<My API key>" & ":" & "<My Secret>"),0),
    Source = Json.Document(Web.Contents("https://platform.devtest.ringcentral.com/restapi/oauth/token", [Headers=[#"Accept"="application/json", #"Content-Type"="application/x-www-form-urlencoded",#"Authorization"=authKey]])),
    #"Converted to Table1" = Record.ToTable(Source)
in
    #"Converted to Table1"

 

Thank you for your help.

 

Best regards,

Slava

2 ACCEPTED SOLUTIONS
mahoneypat
Super User IV
Super User IV

I posted earlier today on a similar question involving get a token and using it in a subsequent web call.  Please see if the pbix attached to that helps you out on this one.

Re: Twitter API to Power BI - Microsoft Power BI Community

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

mahoneypat
Super User IV
Super User IV

You probably can't adapt the Twitter example directly and have it work with your RingCentral one.  I shared it as an example of dynamically getting an access token and then using it in query web calls.  How long does your access token last?  Are you able to do queries with the token hard-coded in?

 

You should be able to see the actual web calls Power BI is making using Fiddler and maybe also with the Query Diagnostics tool within Power BI.

 

I noticed that RingCentral has an API explorer to learn about use of their API.  Have you read all their documentation and used that explorer?

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
mahoneypat
Super User IV
Super User IV

You probably can't adapt the Twitter example directly and have it work with your RingCentral one.  I shared it as an example of dynamically getting an access token and then using it in query web calls.  How long does your access token last?  Are you able to do queries with the token hard-coded in?

 

You should be able to see the actual web calls Power BI is making using Fiddler and maybe also with the Query Diagnostics tool within Power BI.

 

I noticed that RingCentral has an API explorer to learn about use of their API.  Have you read all their documentation and used that explorer?

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

@mahoneypat thank you for your help!

I installed Fiddler and found that the issue was with the symbol "+" on my password that was encoded incorrectly. I changed the password and it works now.

 

Recently I was able to run on Power BI getting data with hardcoded token and obtain token via Postman. Now it works on Power BI as well.

 

Thank you!

 

Slava

mahoneypat
Super User IV
Super User IV

I posted earlier today on a similar question involving get a token and using it in a subsequent web call.  Please see if the pbix attached to that helps you out on this one.

Re: Twitter API to Power BI - Microsoft Power BI Community

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

Hi @mahoneypat , thank you for your quick reply and helping,

I downloaded your PBI file and tried with my URL and credentials, however I still receive error. What I add is username and password to the Content section as it required by RingCentral API and it works on Postman

SlavaSha7_0-1607593202870.png

 

Perhaps the reason is with this requirement?
"

Request Headers

The Content-Type header should be specified as application/x-www-form-urlencodedapplication/x-www-form-urlencoded Please note: Request body should be encoded appropriately. For example email john+doe@example.com as username parameter should be specified so -john%2Bdoe%40example.com.

"

 

Can I somehow get the result JSON that Power BI sends to web API?

 

Thanks for advance.

 

Slava

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors