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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
georgy_gryaznov
Frequent Visitor

How to extract http-response header?

Hi

 

How to extract http-response "set-cookies" header?
How to use WebMethod.Get?

 

3 REPLIES 3
Anonymous
Not applicable

Where can I find more information about this to make a simple example in my power bi query, since I can't replicate your example 😞

Anonymous
Not applicable

how did you manage to solve this? I am trying to obtain the cookies from a query to the server, cookies that will later serve me to make a request to the login

Aron_Moore
Solution Specialist
Solution Specialist

I've done similar work using the R data connection and httr library.

 

A sample of my code:

let
    bodyString = "'{""user_name"":"""&Text.From(UserName)&""",""password"":"""&Text.From(Password)&"""}'",
    Source = R.Execute("library(httr)#(lf)library(jsonlite)#(lf)getToken <- POST(""https://endpoint.com/api/v1/login"", add_headers(""Content-Type""=""application/json""), body = "&bodyString&")#(lf)tokenIs <- cookies(getToken)#(lf)getData <- GET(""https://endpoint.com/api/v1/sr?type=request&insert_time=1483257600000,0"", add_headers(""Content-Type""=""application/json""), set_cookies(""name""=tokenIs$name,""value""=tokenIs$value))#(lf)result <- data.frame(content(getData, ""text""))"),
    result1 = Table.ToRecords(Source{[Name="result"]}[Value]),
    #"Converted to Table" = Table.FromList(result1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    Column1 = #"Converted to Table"{0}[Column1],
    stuff = Json.Document(Column1[#"content.getData...text.."]),
    #"Converted to Table1" = Table.FromList(stuff, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn.....

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 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.