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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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
Employee
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
Employee
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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors