You are not logged in.
Pages: 1
Hey people,
I've written a small app to do a large batch upload. It basically just grabs files and fires them at Third Light using the JSON API, throwing them into folders and adding metadata based on how they were stored in our previous image management system.
The problem is that just about every call I make after 16 hours of runtime returns in failure, giving me either an API_ERROR or an ACTION_NOT_PERMITTED.
So I'm wondering if a session automatically expires after 16 hours. If so, is there a way I can tell it to keep my session alive? Or should I just log out and log in again before my time is up?
Offline
Hi Ironykins,
If you login with the Core_LoginWithKey() method, you're using an API key to authenticate. That will indeed expire after 16 hours, so you would need to logout/login from time to time to get a new session within the 16 hours.
However, if you use the Core_Login() method using a username and password then you can also set the 'persistent' flag in the options, in which case the session won't expire.
I hope this helps.
Michael
Core_Login
Core.Login(string username, string password[, hash options = NULL]) → hash
string username
The user account's username
string password
The user account's password
hash options
A hash of options, detailed below
Returns hash
Returns a session identifier and some details about the user
Starts an IMS user session. After a successful login, this function returns a session identifier. Depending on the communication method being used to access the API, this identifier can be sent as a cookie with name "IMSSESSID", or sent within the body of the normal request. For further information please see the general usage notes for the API.
The options hash supports the following key:
persistent - allow the session to endure beyond the normal limit
The returned hash will contain keys as follows:
sessionId - a session identifier which should be used in all further communication
userDetails - a hash containing user information
type - the type of entity logged into the system. Normally this will be 1, indicating a conventional user
username - the login username
description - name or description
email - email address
Offline
Cool. This clears things up. We will likely create a service account for our more lengthy jobs with the API. Thanks Michael!
Offline
As of IMS v6.1.8-8, Core.LoginWithKey() also accepts an options hash, supporting 'persistent' as a key within it.
Offline
Thanks man! You're wonderful.
Offline
Pages: 1