Title: How to know that your session expired Jira Rest Api
Tags: session;rest;cookies;jira
Question: My project is using Jira Rest Api's.
I am currently storing the cookie I get from the login request and am using that cookie in all other requests.
I am not sure how to handle expired cookie (Session Timeout), do I get something in return from the server if the cookie I used in request is expired?

Here is the accepted answer: I don't have REST enable in my Jira instance, but I can tell you that the other API return an time out error. I have to say that the timeout occurred after a long time though (nor really sure how long and where it's defined).
To see exactly how does the error looks like while using the rest API, you could follow the following steps:
Connect you your Jira instance using the REST API and authenticate.
Run a query to make sure you are connected, for example use http://example.com:8080/jira/rest/api/2/resolution. Just make sure you get an answer. Then, define sleep in your script so it won't do anything for a minute or two.
Log in to your Jira server and restart Jira.
Once the Sleeps ends and Jira is up, run the same query as before. The command will fail and you will get a timeout exception.
For example, using the XML-RPC API i got the following error:
java.lang.Exception: com.atlassian.jira.rpc.exception.RemoteAuthenticationException: User not authenticated yet, or session timed out.
If you'll try this come back and post your finding so other people could benefit from this as well.
Comment for this answer: Thanks for the help, but am currently focusing on finishing my project after that I'll sure try this and reply back to this thread


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2012:00:08/09/12', 'FavoriteCount': 1.0, 'PostTypeId': 1, 'Tags': '<session><rest><cookies><jira>', 'Title': 'How to know that your session expired Jira Rest Api', 'ViewCount': 2379, 'id': 11879450, 'user_AboutMe': None, 'user_AccountId': 449484.0, 'user_DisplayName': 'Yogesh Maheshwari', 'user_Reputation': 1304.0, 'user_Views': 275.0, 'user_id': 844295.0}}