Rest API cookie information /api/v1/auth

Dear Team,
I am using the rest api to download multiple documents from folders due to some requirement. Do we need to Authenticate every time while downloading the document or we can authenticate once and use the same otcsticket for the consequent uploads. in that case how can i check the login is still valid before uploading.
I am using java to create the download program /api/v2/nodes/{id}/content to download the docs.

Please share any information in this regards.

Regards,
Meerasaaheb Mohmmad

Comments

  • Cookie expiration depends on your CS Security Settings (Admin pages). IMO you just need to check the response to each load for a 401 (Authentication required), and if you get a 401 you re authenticate.
    Cheers...

  • Dear John Simon,

    Thanks for your reply.
    You mean to check as below.

    First generate a token and use that token on multiple downloads and if any download is failing with 401 then i should request the new one?
    Please clarify.

    Regards,
    Meerasaaheb Mohmmad

  • Yes, it depends on your security settings. possible values are 1) Never Expire, 2) Expire X minutes after last request, 3) Expire X minutes after last log-in. If you have option 1 then you do not need to worry about it. If you have option 2 then I would also assume you do not need to worry about it because a) you will authenticate, then b) start loading your documents. Every document you load will reset the timer so as long as you add documents more quickly than the timeout value you should be fine. If you have option 3 then yes I would check the response from adding documents and if you get a 401 then you reauthenticate, set your new ticket, and try your document load again.
    Cheers...