Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Microsoft Employee
Microsoft Employee

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
Microsoft Employee
Microsoft Employee

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
Microsoft Employee
Microsoft Employee

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


@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
Microsoft Employee
Microsoft Employee

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


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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.