cancel
Showing results for 
Search instead for 
Did you mean: 
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!
2 REPLIES 2
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 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
March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.

March Events 2023A

March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors
Top Kudoed Authors