SDK

Software development kit

Overview

Labii developed an SDK to use the API. The SDK is available at https://gitlab.com/labii-dev/labii-sdk

Functions

labii_auth(email, password, base_url='https://www.labii.dev')

Get authentication token based on email and password
Args:
email (str): your email address
password (str): your labii password
Note: for the security reasons, please do not hard code the password in your application. We recommend you use 1) input method to collect user input; or 2) AWS parameter store (SSM)
base_url (str): the base_url
Returns:
str: authentication token

labii_get(url, token, base_url='https://www.labii.dev')

A function to do GET for labii api
Args:
url (str): API URL
token (str): authentication token
base_url (str): the base url
Returns:
dict: result of the url

labii_get_all(url, token, base_url='https://www.labii.dev'):

A function to do GET for labii api, loop for all pages
Args:
url (str): API URL
token (str): authentication token
base_url (str): the base url
Returns:
dict: result of the url

labii_get_headers(token='')

Return necessary headers for API functions
Args:
token (str): the user token.
use "" to skip
Returns:
dict: header objects

labii_login(base_url='https://www.labii.dev')

Get authentication token based on user input
Returns:
str: authentication token

labii_patch(url, data, token, base_url='https://www.labii.dev')

A function to do PATCH for labii api
Args:
url (str): API URL
data (dict): data to update, see API documentation (https://docs.labii.com/api/overview) for the format
token (str): authentication token
base_url (str): the base url
Returns:
dict: return of the api

labii_post(url, data, token, base_url='https://www.labii.dev')

A function to do POST for labii api
Args:
url (str): API URL
data (dict): data to POST, see API documentation (https://docs.labii.com/api/overview) for the format
token (str): authentication token
base_url (str): the base url
Returns:
dict: created object

labii_update_cell(token, organization__sid, row__sid, column__sid, data, base_url='https://www.labii.dev')

update the data for a cell, create the cell if not exists
Args:
token (str): authentication token
organization__sid (str): the sid of the organization
row__sid (str): the sid of the row
column__sid (str): the sid of the column
data (dict): data for the cell
base_url (str): the base_url
Returns:
dict: the cell data

labii_update_row(token, organization__sid, table__sid, data, base_url='https://www.labii.dev')

Get or update a row.
- if 'sid' is provided, the row will be updated
- if 'sid' is not provied, a new row will be created
Args:
token (str): the authentification token
organization__sid (str): the sid of your organization
table__sid (str): the sid of the table
data (dict): other attributions, in json format
base_url (str): the base_url
Returns:
dict: the row object.

labii_update_section(token, organization__sid, row__sid, widget__sid, data, base_url='https://www.labii.dev')

update the data for a section, create the section if not exists
Args:
token (str): authentication token
organization__sid (str): sid of a organization
row__sid (str): the sid of a row
widget__sid (str): the sid of widget
data (dict): the section data
base_url (str): the base_url
Returns:
dict: the section object

labii_json_list_to_tsv(results)

conver the list result in json format into tsv format
Args:
results (array): the results from response
Returns:
string: tsv data

DATA

base_url = 'https://www.labii.dev'