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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
-jmdaher-
Regular Visitor

Add a body to web.contents

Hello! I want to add a body to this code: 

 

let
url = "https://pos.linisco.com.ar/sale_orders",

Source = Json.Document(Web.Contents(url, [Headers = [#"Content-Type"="application/json", #"Accept"="application/json", #"X-User-Email"="xxxxxx", #"X-User-Token"="xxxxxx"]])),

in
Source

 

The body in postman is:

jmdaher_0-1668968136743.png

{
    "fromDate" : "1/1/2022",
    "toDate" : "12/11/2022"
}
 
Any suggestions? 
 
Thanks!
3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @-jmdaher- ;

You could refer to Solution from here: https://eriksvensen.wordpress.com/2014/09/15/specifying-json-query-in-power-query-example-statistics...

let
	content = "{
		""from date"": ""1/1/2022"",
		   ""to date"": ""12/11/2022"",
	}",

	Source = Json.Document(Web.Contents("https://api-sandbox.direct.yandex.com/json/v5/campaigns", [Headers=[Authorization="Bearer AQAAAAANlKwBAAQQn4Wfgbxxxxxxxxxx"], Content=Text.ToBinary(content)]))
in
    Source


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I receive an error:

DataSource.Error: Web.Contents with the Content option is only supported when connecting anonymously.

I tried with this and I didn´t have a result:

 

jmdaher_0-1669347960916.png

This is the error:

DataSource.Error: Web.Contents failed to get contents from 'https://pos.linisco.com.ar/sale_orders' (404): Not Found
Details:
DataSourceKind=Web
DataSourcePath=https://pos.linisco.com.ar/sale_orders
Url=https://pos.linisco.com.ar/sale_orders

 

I don´t know how to resolve it.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors