no active session when sending API request

  • 1
  • Question
  • Updated 2 months ago
  • Answered
Hi,
according to documentation the logon require 2 request (which i am able to run successfully)

 curl -k -X POST  https://my-ip/wsg/api/public/v8_1/session --data '{"username":"admin","password":"password"}' -H 'Content-type: application/json'
this returns only version which has no use.

the 2nd request is the serviceticket -
curl -k -X POST  https://my-ip/wsg/api/public/v8_1/serviceTicket --data '{"username":"admin","password":"password"}' -H 'Content-type: application/json' - this return a string

now the request i am trying to run is /v8_1/aps - to get the list of aps<br>
according to documentation i need a session ID instead of the user password i dont seem to find session ID in the 2 request above, i tried using the service ticket instead of the session ID without success obviously, 

any ideas how to get it done or what i am missing? thanks. 


Photo of tomer iyar

tomer iyar

  • 15 Posts
  • 0 Reply Likes

Posted 2 months ago

  • 1
Photo of Lawrence Smith

Lawrence Smith

  • 5 Posts
  • 1 Reply Like
When you submit your first POST you will get a JSESSION Cookie ID. Add that that to your second (and any subsequent) API call(s) payload and you should get authenticated.
Photo of tomer iyar

tomer iyar

  • 15 Posts
  • 0 Reply Likes
Hi Lawrence,
thanks for replying but when i run the first post-
[[email protected] ~]# curl -k -X POST  https://my-ip/wsg/api/public/v8_1/session --data '{"username":"admin","password":"my-password"}' -H 'Content-type: application/json'  

this is the response i get- {"controllerVersion":"5.1.1.0.598"}
i dont see any JSESSION ID.

thanks.
Photo of Lawrence Smith

Lawrence Smith

  • 5 Posts
  • 1 Reply Like
Oh, yes - you need to add the "-i" option to the curl to see the cookie.