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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Neiners
Helper II
Helper II

Get-Cookies from API

I have an API that uses the post method for authentication

Content = "{""username"":""username"", ""password"":""password""}". I receive the message that the Login was successful.

 

That authentication session (which I believe is Get-Cookie JSESSIONID) is to be used for another api that also uses a post method to grab a list of records based off of the search criteria used in the post. Example: Content = "{""searchfield"":""searchterm""}".

 

I have searched everywhere and I can't find anything that points me in the right direction. I don't see where the  JSESSIONID is provided in the response from the authentication api. When I put either of the APIs in postman, they both have Set-Cookie listed under Headers with JSESSION ID=xxxxxxxx; Path =/(path name) and other information. Any help would be greatly appreciated.

1 REPLY 1
Neiners
Helper II
Helper II

I'm still trying to get this to work. I am able to sucessfully authenticate to the Login_URL but am getting stuck on how to retrieve the data once I authenticate. The Xml.Table that gets generated for the response is our ID, username, password (which is blank for security reasons) and a message showing a success or failure.

My API document has this: 

https://SOURCE URL/RELATIVE PATH/rest/auth/login
Method POST, To Login, return OK (200) or other error response.
Login Data: {"username":"{Username}","password":"{Password}"}

I am using the following code for the Login authentication

let
Source = Login_URL,
Content = Credentials,
Response = Xml.Tables(Web.Contents(Login_URL, [Content=Text.ToBinary(Content), Headers=[#"Content-Type"="application/json"]]))
in
Response

Data_URL:
https://SOURCE URL/RELATIVE PATH/rest/service/list/object
Method POST, Login is required, return a list of JSON or XML Object and OK (200) or other error response.
Input Data:
{"field1":"{field1}","field2":"{field2}"}

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.