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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Neiners
Frequent Visitor

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
Frequent Visitor

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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