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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
EiA
Frequent Visitor

Accessing Planday API with M

Hi,

 

I am trying to access the APIs of Planday (explained in detail here) from Power Query, but I have some issues authenticating to get the access token.

 

The relevant info about the API:

Before you can make calls to the API resources, you first need to obtain an Access Token by exchanging the Refresh Token from the previous sections for an Access Token. To do this, you need to make a POST request using any tool you want that can make HTTP calls (curl, postman, etc.) The request is as follows (replace CLIENT_ID and TOKEN with appropriate values):

POST https://id.planday.com/connect/token Request Headers: Content-Type: application/x-www-form-urlencoded Request Body: client_id=CLIENT_ID&grant_type=refresh_token&refresh_token=TOKEN

 

My query attempt that receives a 400 - Bad attempt error:

let
url = "https://id.planday.com/connect/token",
body = "client_id=<MyClientId>,grant_type=refresh_token,refresh_token=<MyRefreshToken>",
Source =
Json.Document(Web.Contents(url, [Headers=[#"Content-Type"="application/x-www-form-urlencoded"],Content=Text.ToBinary(body)]))
in
Source

 

My knowledge of M is quite limited, so my attempt may be way off, but I have tried copying another query that works in a similar case with other APIs. 

 

If any of you are able to spot an error or rewrite the entire query for it to work - it would be highly appreciated!

 

Thanks!

1 ACCEPTED SOLUTION

Use Fiddler or similar to inspect the packet you are sending for any other potential format issues. APIs often expect the payload base64 encoded etc.

View solution in original post

4 REPLIES 4
EiA
Frequent Visitor

Thanks again @lbendlin . I used another tool to find out the issue was with the API-access itself. Once fixed, my code worked with your suggestion of using "&".

lbendlin
Super User
Super User

Body: client_id=CLIENT_ID&grant_type=refresh_token&refresh_token=TOKEN

 

you are using comma  (,)  instead of ampersand (&)  in your implementation.

EiA
Frequent Visitor

Thanks for getting back to me on this @lbendlin , but unfortunately it still gives the same 400-error. Any other suggestions?

Use Fiddler or similar to inspect the packet you are sending for any other potential format issues. APIs often expect the payload base64 encoded etc.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.