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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
DiKi-I
Helper IV
Helper IV

How to Setup Xero connection to Power BI through xero api

Has anyone used xero api to pull the data in power bi using m-query? I don't want to use any third party connector.

2 REPLIES 2
Ritaf1983
Super User
Super User

Hi @DiKi-I 

Maybe you can try something like:

To use the Xero API to pull data into Power BI using M Query without a third-party connector, follow these steps. This involves making HTTP requests directly to the Xero API in M Query. The process typically includes:

Registering an App in Xero: Register an app in the Xero portal to obtain the required credentials (Client ID and Client Secret).
OAuth 2.0 Authentication: Implement the OAuth 2.0 flow to get an Access Token for API access.
M Query Scripting: Write M Query in Power BI to send requests to the API using functions like Web.Contents.
Here is an example of basic M Query code to make an API request:

m
Copy code
let
BaseUrl = "https://api.xero.com/api.xro/2.0/Invoices",
Headers = [Authorization = "Bearer YOUR_ACCESS_TOKEN"],
Source = Web.Contents(BaseUrl, [Headers = Headers])
in
Source
For more detailed guidance, you may refer to general documentation on OAuth 2.0 authentication 

https://developer.xero.com/documentation/oauth2/auth-flow

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Thank you, I'm trying to register the app, could you help me with redirect URI and how I can generate access token -OAuth 2.0 Authentication: Implement the OAuth 2.0 flow to get an Access Token for API access.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.