Forum Discussion
API IN POWER BI POST
- 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
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_Response
Regards
Phil
Thanks
Perfect solution, I just had to make adaptations but it worked, thank you very much!
Regards
Vinicius
- Anonymous4 years agoNot applicable
Hi Vinicius, I'm looking to do exactly the same thing that you are doing here. Could you please help me? I've done a registry of app on Meli and have the Id and Secret... but still can't connect...!!!
- lbendlin4 years agoSuper User
Don't forget that you have to base64 encode the client id and secret as shown in the solution.
- Anonymous4 years agoNot applicable
Could you please help me with this??
- Anonymous4 years agoNot applicable
Hi again, could you please paste the query that worked for you to connect to the Mercadolibre API with PBI??