LangLion Developer Wiki

⚠️ APIv2 is legacy

APIv2 is considered legacy and is no longer recommended for new integrations.

We strongly encourage you to use APIv4 for all new integrations and to migrate existing integrations where possible.

Please refer to our latest APIv4 documentation for up-to-date information and integration guidelines:

Click here to view the APIv4 example documentation - your own documentation is at https://[your-instance].langlion.com/api/v4/docs

Basic filtering

Lists returned by the API can be filtered by entities' fields. Some endpoints have their own filter parameters (e.g. schoolId, createdAt) described on the endpoint's page; endpoints with the filter parameter accept the JSON filter described below.

Basic JSON filtering

Basic filtering based on entities' fields is possible with JSON filter passed in query string as a 'filter' parameter.

Example

1https://test.langlion.com/api/v2/schoolClasses?filter={"where":{"name":{"like": "%English%"}}}

Advanced JSON filtering

Building complex filters (including joining conditions and filtering the same fields with different operators - in SQL manner) is possible with comparison and logical operators using filter in JSON format passed in query string as 'filter' parameter (see Basic JSON filtering above).

Logical operators

Joining a few conditions is possible with logical operators passed as a key of object containing conditions.

Available logical operators

and - all conditions in conditions' array should be met
or - one of conditions in conditions' array should be met

Comparison operators

Field based filtering is possible with comparison operators passed as a key of object containing value.

Available comparison operators

eq - equals (default)
gt - greater than
gte - greater than or equals
lt - less than
lte - less than or equals
like - pattern matching (wildcard sign: %)
notLike - reverse of like

Example

 1{
 2   "where":{
 3  	"and":[
 4     		{
 5        	"newLesson.startDate":{
 6           		"lt":"2023-03-02 13:30:00"
 7        	},
 8         		"schoolClass.id": 19
 9     		}
10  	]
11   }
12}

Combining JSON filter and limiting records

Example

1https://test.langlion.com/api/v2/students?filter={"where":{"and":[{"user.type":1}]}}&recordFrom=1&recordTo=20`