Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.
SOLVED

Connect API session cookie

paul_houghton
12 - Quasar

Im planning out a custom connect sync application and trying to workout what the use of session_cookie is for. Looking at the API endpoints, you get the session_cookie when you log in but I cannot see any endpoints that use the session cookie.

For example, the entry endpoint only needs the xid and there are no needed headers aside from the application type:

curl -X GET http://localhost:8080/rest/1/entry/MzRlM2RhZTAtMzc1YS00YTBjLTk5ODMtYzQzYTBiMDFiNWFh" -H "accept: application/json;charset=UTF-8"

 

So whats the point in the session_cookie or where does it get entered in the query?

2 REPLIES 2
PetrT
Alteryx
Alteryx

Hi @paul_houghton , you need to send the session_id as "JSESSIONID" cookie along with your API request. As you are working on Connect synchronization, you probably know our metadata loaders. If not, you can download them here . After installytion you can search for

connect_api_helper.py

to see how to deal with different ways of authentication.

paul_houghton
12 - Quasar

Hey @PetrT thanks for that, I hadn't seen that helper script and where to use the cookie makes sense now. TBH I think there should be a note somewhere in the Connect SDK documentation to clarify that.

 

I previously would just use request_tokens in headers but I haven't interacted with the cookie sessions before (the examples using curl have no mention of the --cookie flag to reuse the sign in cookie)