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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors