SDK (python)
Labii SDK
SDK is the toolkit with prebuilt Labii components that developers use to interact with Labii APIs. Full documentation available at https://docs.labii.com/api/overview
Usage
Install the Labii SDK
2. Import the package
3. Initial the API object
4. Start querying
Initial SDK
During SDK initiation, the following parameters can be customized:
base_url
, the server base URL, defaults to https://www.labii.dev. If you are using a different data center, make sure to change thebase_url
setting.api_key
, the API Key to get authenticated.organization__sid
, your organization sid. You can find it by logging into Labii (https://www.labii.com/login/) and going to Side menu -> Settings -> Organization -> Sidapi,
the APIObject. If a new APIObject is not provided, it will be automatically created. Utilize this functionality when you require authentication for the API before initializing a Labii Object.
Objects
Labii objects for interaction. Learn more at https://docs.labii.com/api/overview#objects
Profile
APIKey
Organization
Application
Subscription
People
Team
SAML
OrganizationWidget
Backup
Project
ProjectMember
Table
Column
Section
Filter
Record
Cell
Version
Visitor
Activity
Workflow
Step
Widget
Dashboard
Notification
Methods
A list of methods for interacting with objects.
create
Create a object.
data
(dict), a JSON dict data to post. Learn more at https://docs.labii.com/api/methodsquery
(optional), additional query to limit the results.
retrieve
Return a object
sid
, the sid of the objectquery
(optional), additional query to limit the results.
list
Get a list of objects
page
(default=1), the page number to return.page_size
(default=10), the number of items to be paginated.all_pages
(bool, default=False), Whether all pages should be returned. When False, only return the data for the first page. Only applies to list views.level
(default to "organization"), the scope of records to retrieve. Learn more at https://docs.labii.com/api/overview#levelsserializer
(default to "list"), the scope of fields of the return data. Learn more at https://docs.labii.com/api/overview#serializername, return only sid and name, very fast
list, return selected fields of the objects, fast
detail, return all fields of the objects, slow
query
(optional), additional query to limit the results.
modify
Edit an object
sid
, the sid of the objectdata
(dict), a JSON dict data to post. Learn more at https://docs.labii.com/api/methodsquery
(optional), additional query to limit the results.
delete
Remove an object
sid
, the sid of the objectquery
(optional), additional query to limit the results.
Not all objects can be deleted. A 405 error will be displayed if an object cannot be deleted.
File operations
Labii also developed a few functions to facilitate the file uploading.
upload
Upload a file to Labii
file_path
, the full file pathprojects
, list of projects in the format of [{"sid": "project__sid"}]
watch_folder
You can use this function to watch a particular folder. As soon as the file(s) are present, the function will upload each file to Labii and move the file to the "uploaded" subfolder. This function allows you to upload files generated by a machine/equipment automatically.
Version 1.9 or later is required to use this function.
folder_path
, required, the folder (including the path) to watch. default to current path.projects
, required, list of projects in the format of [{"sid": "project__sid"}]interval
, optional, time interval to check the folder, default to 5 seconds.
Other
Switch organization
Utilize this function for seamlessly transitioning between various organizations. This will prove especially advantageous when transitioning from a test organization to a production organization.
Get columns
When you're in the process of generating a new record, it's frequently necessary to have the column SID in order to prepare the data object. In Python, obtaining the index of an object in an array isn't always a straightforward task. This is why we have developed this function to simplify the coding process when working with the Labii SDK.
Last updated