This topic is under construction for the 18.1 release of LabKey Server. For current documentation of this feature, click here.
To enable programmatic use of data as if "attached" to a given session, an administrator can configure the server to allow the user to obtain a Session Key
Configure Session Keys
- Select (Admin) > Site > Admin Console.
- Click the Admin Console Links tab.
- Under Configuration, click Site Settings.
- Under Configure API Keys, check the box for Allow Session Keys.
Access and Use a Session Key
Once enabled, the user can log in, providing all the necessary compliance information, then retrieve their unique session key from the username
The session ID is a long, randomly generated token, beginning with the prefix "session|" that is valid for only this single browser session. Click Generate Session Key
to see it; click Copy to Clipboard
to grab it. Then click Done
You can then paste this key into a script or other API access of data. Your use of the data will be logged with all the same data access information you provided when you logged in.
For example, if you were accessing data via R, the following shows the usage:
labkey.setDefaults(apiKey="session|the_rest of the_long_string_session_id")
You will then be able to access the data from R until the session associated with that key is terminated, whether via timeout or log out.