-
-
Save saostad/5e725481fdf23404717c97d40a44a5c7 to your computer and use it in GitHub Desktop.
Loading GraphQL data (GitHub API v4) into PowerBI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script shows how to use M language (Power Query Formula Language) | |
// to read data from GitHub API v4 using a POST request. | |
// This can come in handy when building PowerBI reports that utilize GraphQL endpoints for loading data. | |
let | |
Source = Web.Contents( | |
"https://api.github.com/graphql", | |
[ | |
Headers=[ | |
#"Method"="POST", | |
#"Content-Type"="application/json", | |
#"Authorization"="Bearer <your_personal_token_here>" | |
], | |
// Notice the quote escaping here | |
Content=Text.ToBinary("{""query"": ""{ organization(login: \""github\"") { name }}""}") | |
] | |
), | |
#"JSON" = Json.Document(Source) | |
in | |
#"JSON" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment