Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi Everyone,
I need to connect to a supplier's portal to receive data from there.
The API has been tested outside Power BI and the POST - GET request looks like this:
----------------------------------------------
curl --request POST \
--url1 https://XXX \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=XXX \
--data client_secret=XXX
And using the received token:
curl --request GET \
--url2 'https://api.XXX' \
--header 'Authorization: Bearer (token)'
--------------------------------------------------
I having a hard time to mimic the same in Power Query.
After a while I was succesfully created the POST request and received the Bearer access_token, but struggling to create a GET request, where I need to use the received token.
Is anyone has an easy fix for that? I would appriciate that. Thanks.
----------------------------------------------------
My POST request in Power Query looks like this:
let
url = "url1",
headers = [#"Content-Type" = "application/x-www-form-urlencoded", #"Accept" = "*/*"],
postData = [
grant_type = "client_credentials",
client_id = "xxx",
client_secret = "xxx"
],
response = Json.Document(Web.Contents(url,
[
Headers = headers,
Content = Text.ToBinary(Uri.BuildQueryString(postData))
]))
in
response
As a result of the above I have received the access_token. But how should I continue in order to get data from the supplier's portal?
Solved! Go to Solution.
as you mention you need to present the token in the header of the GET request.
curl --request GET \
--url2 'https://api.XXX' \
--header 'Authorization: Bearer (token)'
xx = Web.Contents(url2,[Headers=[Authorization="Bearer " & token]])
as you mention you need to present the token in the header of the GET request.
curl --request GET \
--url2 'https://api.XXX' \
--header 'Authorization: Bearer (token)'
xx = Web.Contents(url2,[Headers=[Authorization="Bearer " & token]])