Overview

Overview of Labii API

Labii API is a REST API and it support all different calling methods.

URL

Object has two type of url represent two different views:

  • List of objects

    {{base_url}}/{app}/{model}/list/{level}/{sid}/{serializer}/
  • Detail of a object

    {{base_url}}/{app}/{model}/detail/{sid}/

Wheres,

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

  • app, the name of application. See here for more details.

  • model, the name of model. See here for more details.

  • level, the scope of records to retrieve. See Levels for more details.

  • sid, Static and encrypted labii object id. It have to match with level. Of level=organization, the sid have to be the sid of the organization.

  • serializer, scope of fields of the return data

    • name, return only sid and name, very fast

    • list, return selected fields of the objects, fast

    • detail, return all fields of the objects, slow

Objects

You can use Labii API to query these objects:

Name

Description

App

Model

Organization

The organization object

organizations

organization

Personnel

Member of the organization

organizations

personnel

Team

Team of the organization

organizations

team

Organization Widget

Installed widgets

organizations

organizationwidget

Statement

Monthly statement

organizations

statement

Backup

Backup data

organizations

backup

Project

The project object

projects

project

Project Member

Project member or team

projects

member

Table

The table object

tables

table

Column

The columns of a table

tables

column

Row

The rows of a table

tables

row

Cell

The cells of a row

tables

cell

Section

The sections of a row

tables

section

Version

The versions of a row

tables

version

Filter

The filters of a table

tables

filter

Workflow

The workflow of a table

tables

workflow

Step

The steps of a workflow

tables

step

Activity

User activities

activities

activity

Widget

The widget object

widgets

widget

Levels

Levels defines the scope of records to retrieve. It is a required parameter for list API. These levels are used at Labii:

  • organization: return the results within the organization level

  • user: return the results for a particular user (deprecated)

  • project: return the results for a project (deprecated)

Not all levels are available for all list API. Error of HTTP_406_NOT_ACCEPTABLE will return if a wrong level is used. The table below lists all allowed levels:

List API

level=organization

level=user

level=project

Organization List

Yes

Yes

-

Organization Member List

Yes

-

-

Team List

Yes

Yes

-

Organization Widget

Yes

-

-

Statement List

Yes

-

-

Backup List

Yes

-

-

Project List

Yes

Yes

-

Project Member List

Yes

-

Yes

Table List

Yes

-

-

Column List

Yes

-

-

Filter List

Yes

Yes

-

Row List

Yes

Yes

Yes

Cell List

Yes

-

-

Section List

Yes

-

-

Version List

Yes

-

-

Activity

Yes

Yes

-

Widget

*

-

-

Methods

Here are list of methods used:

  • GET: Fetch one or more objects

  • POST: Create an object

  • PUT: Update an object

  • PATCH: Partially update an object

  • DELETE: Remove an object

Different roles have different permissions in using the methods. There are five roles at the organization level:

  • Admin: The administrators

  • Member: The members of the organization

  • Alumni: The members who have left the organization

  • User: Other Labii users who do not belong to the organization

  • Anonymous: Unauthorized user

And 3 roles at the project level:

  • Project Admin: The administrator of a project

  • Project Edit: The members has edit permission at the project

  • Project View: The members has view permission at the project

API

GET

POST

PUT

PATCH

DELETE

Organization List

Admin, Member

Admin

-

-

-

Organization Detail

Admin, Member

-

-

Admin

-

Organization Member List

Admin, Member

Admin

-

-

-

Organization Member Detail

Admin, Member

-

-

Admin

-

Team List

Admin, Member

Admin

-

-

-

Team Detail

Admin, Member

-

-

Admin

Admin

Organization Widget List

Admin, Member

Admin

-

-

Admin

Organization Widget Detail

Admin, Member

-

-

-

Admin

Statement List

Admin

-

-

-

-

Statement Detail

Admin

-

-

-

-

Backup List

Admin

Admin

-

-

-

Backup Detail

Admin

-

-

-

-

Project List

Admin, Project Admin, Project Edit, Project View

Admin

-

-

-

Project Detail

Admin, Project Admin, Project Edit, Project View

-

-

Admin, Project Admin

-

Project Member List

Admin, Project Admin, Project Edit, Project View

Admin, Project Admin

-

-

-

Project Member Detail

Admin, Project Admin, Project Edit, Project View

-

-

Admin, Project Admin

Admin, Project Admin

Table List

Admin, Member

Admin

-

-

-

Table Detail

Admin, Member

-

-

Admin

-

Column List

Admin, Member

Admin

-

-

-

Column Detail

Admin, Member

-

-

Admin

-

Filter List

Admin, Member

Admin, Member

-

-

-

Filter Detail

Admin, Member

-

-

Admin, Member

Admin, Member

Row List

Admin, Project Admin, Project Edit, Project View

Project Admin, Project Edit

-

Project Admin, Project Edit

-

Row Detail

Admin, Project Admin, Project Edit, Project View

-

-

Project Admin, Project Edit

-

Cell List

Admin, Project Admin, Project Edit, Project View

Project Admin, Project Edit

-

-

-

Cell Detail

-

-

-

Project Admin, Project Edit

-

Section List

Admin, Project Admin, Project Edit, Project View

Project Admin, Project Edit

-

-

-

Section Detail

Admin, Project Admin, Project Edit, Project View

-

-

Project Admin, Project Edit

-

Version List

Admin, Project Admin, Project Edit, Project View

-

-

-

-

Version Detail

Admin, Project Admin, Project Edit, Project View

-

-

-

-

Activity List

Admin, Member

-

-

-

-

Activity Detail

-

-

-

-

-

Widget List

Admin, Member

-

-

-

-

Widget Detail

Admin, Member

-

-

-

-

Status Codes

Here is a list of status code used by Labii API:

  • HTTP_200_OK: return when api call successful

  • HTTP_201_CREATED: return when a object is created

  • HTTP_204_NO_CONTENT: return when a object is successfully deleted

  • HTTP_401_UNAUTHORIZED: return when user is not authenticated

  • HTTP_403_FORBIDDEN: return when user do not have permission

  • HTTP_406_NOT_ACCEPTABLE: return when parameter is not correct

  • HTTP_500_INTERNAL_SERVER_ERROR: return on internal errors

Example

Get a list of records with curl:

curl -X get https://www.labii.dev/tables/rows/list/organization/xxx/list/ -H "Authorization: Token xxxx"

In Python:

import requests
headers = {
"X-Forwarded-For": "batch",
"Content-Type": "application/json",
"Authorization": "Token %s" % token
}
requests.get(url="https://www.labii.dev/tables/rows/list/organization/xxx/list", headers=headers)