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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
ChristianGeiger
Frequent Visitor

Use a REST API with content in online Service (Gateway)

Hallo, 

 

i would like to use a REST API to get data from a server.  The issue on this api is , that it needs a body to work proper.

 

 

 

let
    url = "http:xxxxxxx/ExecuteCollectionQuery",
    body = "[
	{
	   ""collectionQuery"" : ""(context) => 
			context
			.Parts()	
			.OrderBy(part => part.Id)""   
	}]
",
   Source  = Json.Document(Web.Contents(url, [
	   Headers=
   			[#"Content-Type"="application/json",  
    		 #"Accept-Language"="de",
			 #"Accept"="*/*",
			 #"Authorization"="Basic cHJvY2FkOnByb2NhZA==",
			 #"User-Agent" ="ProwerBi"	
			],  Content=Text.ToBinary(body)
	]))
in
    Source

 

 

 

As you see in the code above i use 'Basic' authentication hardcoded. 

In the connector view i do not have any possibility to add a Body

 

ChristianGeiger_0-1628846652989.png

As i told when executing the query above i works in Desktop. But when publishing to the service i cannot set a refesh , because the dataset needs a gateway connection!

ChristianGeiger_1-1628846893687.png

If i want to add the source to the gateway, the connection wont work, because the api need a body,  there i cannot put a body.

ChristianGeiger_2-1628847166506.png

 

So how can i use a api in the service ?! Somehow i have to fool the service not to use a gateway, because everything is configuted in the dataset ??!

 

best regards 

 

Christian 

 

1 REPLY 1
ibarrau
Super User
Super User

Hi. You shouldn't use gateway. You are right. You can go to Schedule Refresh or Dataset configuration and look for Data Source Credentials. You have to specify the credentials only. Because this is a web source you can avoid gateway.

ibarrau_0-1628857183545.png

 

NOTE: If you have on premise data sources added to the power bi dataset you need to turn an option in your gateway to handle hybrid sources (on premise and cloud)

I hope that helps,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.