API Session ID

Topics brought up by the TimeTrex open source community.
Post Reply
royalpublishing
Posts: 14
Joined: Mon Nov 30, 2015 3:30 pm

API Session ID

Post by royalpublishing » Thu Dec 21, 2017 8:03 am

Using JSON via the API, is there a way to check whether an API session ID is valid or not? I know you can always just create a new session ID but it seems like a logical approach would be to test whether a session ID is still valid (ie it exists and is not expired) first before requesting a new one.

shaunw
Posts: 7478
Joined: Tue Sep 19, 2006 2:22 pm

Re: API Session ID

Post by shaunw » Thu Dec 21, 2017 9:08 am

You can call APIAuthentication->isLoggedIn() to check that.

Alternatively the API will return a SESSION code error if the session has expired, in which case you could just call Login() again.

royalpublishing
Posts: 14
Joined: Mon Nov 30, 2015 3:30 pm

Re: API Session ID

Post by royalpublishing » Thu Dec 21, 2017 9:13 am

Excellent, thank you sir.

Post Reply