API Client (javascript)
Labii API Client for javascript
Last updated
Labii API Client for javascript
Last updated
Labii SDK for JavaScript is a software development kit (SDK) that provides a set of tools and libraries for developing web applications using the Labii platform. The Labii platform is a cloud-based platform that allows researchers to manage their research data and workflow, including data collection, storage, analysis, and sharing.
The Labii SDK for JavaScript allows developers to integrate Labii's features and functionality into their web applications. It includes a variety of APIs that allow developers to access and manipulate data stored on the Labii platform, such as data entry forms, project management tools, and reporting features.
The SDK includes a JavaScript library that provides a high-level interface for interacting with the Labii API. It also includes a set of documentation and examples to help developers get started with using the SDK and integrating it into their applications.
Overall, the Labii SDK for JavaScript provides a powerful set of tools and resources for developers looking to build web applications that incorporate the features and functionality of the Labii platform.
Install the Labii SDK
Import the package
Initial the API object
During API initiation, the following parameters can be customized:
base_url
, the server base url, defaults to . If you are using a different data center, make sure to change the base_url
setting.
email
and password
, the email or password to get authenticated. If no email or password is provided, a pop-up will appear.
organization__sid
, your organization sid. You can find it by logging into Labii () and going to Side menu -> Settings -> Organization -> Sid
sid
(default to "organization__sid"), the static and encrypted Labii object id. It has to match with level.
name, 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.
app
and model
(required), same as above
sid
(required), the sid of the object.
query
(optional), passing additional parameters during querying.
Return necessary headers for API functions.
is_authorized
(default to True
), To use a header without authentication information, set is_authorized=False
.
Get authentication token.
api.login()
The user will be prompted to provide an email/password if they have not previously provided a credential.
When an email or password has already been provided, you will receive a new token.
api.login(email=xxx, password=xxx)
Login with a provided email/password.
Labii enforces the Excessive Session Timeout seurity (U.S. CNSS - CNSSI No. 1253 section AC-11). Your account will be logged out after 30 minutes of inactivity. Call this function to generate a new token if your application is continuously running or is performing queries after 30 minutes of inactivity.
Note: For the function to work, you must run api.login()
first.
A function to do POST for labii api
url
(str), the URL to post. Generate a standard URL with get_list_url
.
is_authorized
(default to True
), whether authorized tokens should be used.
A function to do PATCH for labii api
url
(str), the URL to post. Generate a standard URL with get_detail_url
.
is_authorized
(default to True
), whether authorized tokens should be used.
A function to do GET for labii api.
url
(str), the URL to post. Generate a standard URL with get_list_url
or get_detail_url
.
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.
is_authorized
(default to True
), whether authorized tokens should be used.
A function to do DELETE for labii api.
url
(str), the URL to post. Generate a standard URL with get_detail_url
.
is_authorized
(default to True
), whether authorized tokens should be used.
Use this function to create a url for .
app
and model
(required), the app and object to limit the type of data in Labii. Learn more at .
level
(default to "organization"), the scope of records to retrieve. Learn more at
serializer
(default to "list"), the scope of fields of the return data. Learn more at
Use this function to create a url for .
data
(dict), a JSON dict data to post. Learn more at
data
(dict), a JSON dict data to post. Learn more at