cancel
Showing results for 
Search instead for 
Did you mean: 

I'm trying to acquire a valid logon session, but I get "no active session"

alberto_capelli
New Contributor
Beginner here, I'm following API guide to acquire a login session.
I'm testing with curl command like this


curl  https://{server-ip:server-port}/wsg/api/public/v5_1/session -k -X GET

But I get the following error:

{"message":"Current session has timed out.","errorCode":201,"errorType":"No active session"}
3 REPLIES 3

jamie_walmsley
New Contributor III
Hi,

You need to be doing sending a POST rather than a GET and you also need to pass in JSON for the username/pass

data = {    "username": username,
                "password": password,
                "timeZoneUtcOffset": "+00:00"
        }

alberto_capelli
New Contributor
Hi, I tried like you said, specifying also Content-type it seems to work!
curl  https://{ip:port}/wsg/api/public/v5_1/session -k -X POST --data '{"username":"admin","password":"Mypass.1","timeZoneUtcOffset":"+01:00"}' -H 'Content-type: application/json'
thank you

jamie_walmsley
New Contributor III
No problems!

Once you logon it'll give you back a session ID which needs to be passed with every API call along with the content type so for example;

{'Content-Type': 'application/json;charset=UTF-8','Cookie': 'JSESSIONID='GDHDHDAAA'}