Forum Discussion
viniciuscastilh
5 years agoFrequent Visitor
API IN POWER BI POST
Good afternoon I need to integrate the Mercado Livre api into Power BI, I need to make a Post inside the Body But I never made a Post on Power Bi, could you help me? The basis for calling the API ...
- 5 years ago
Does that cURL POST work?
The general form for making a POST in PBI/PQ is
Source = Json.Document(Web.Contents(url,[ Headers = [#"Content-Type"="application/json"], Content = Text.ToBinary(body) ] ))In your particular case try this
let api_url = "https://api.mercadolibre.com/", token_path = "oauth/token", ClientID = "xxxxxxxx", ClientSecret = "xxxxxxxx", EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(ClientID & ":" & ClientSecret), BinaryEncoding.Base64), Token_Response = Json.Document(Web.Contents(api_url, [ RelativePath = token_path, Headers = [#"Content-Type"="application/x-www-form-urlencoded",#"Authorization"=EncodedCredentials], Content=Text.ToBinary("grant_type=authorization_code") ] ) ) in Token_ResponseRegards
Phil
lbendlin
4 years agoSuper User
Don't forget that you have to base64 encode the client id and secret as shown in the solution.
Anonymous
4 years agoNot applicable
Could you please help me with this??