Introduction
v3 VS v4
Behavioral and structural differences between v3 and v4 API generations.
These Legacy APIs may suffer from inconsistencies between endpoints, most likely due to them adhering to a different standard: either v3 or v4.
The easiest way of figuring out which standard a Legacy API endpoint adheres to si to check its URL:
- if it starts with
/api/v3/**
, then it is definitely a “v3” API. - if it contains the name of an application, e.g.
/timmi-absences/api/**
, then it most likely is a “v4” API.
Here is a recap of behavioral differences between both standards:
Feature | v3 | v4 |
---|---|---|
Expanding responses | By default, only 3 properties are returned: id , name and url . You may include more properties, and even those of related resources, through the use of the ?fields query parameter. Nested objects properties can be included like this: ?fields=id,nestedObject[a,b,c] . | All properties are always returned, except the total number of items of a collection, which can be included with the ?fields.root=count query parameter. You have no control over this. |
Paging | Paging is handled through two comma-separated parameters in a single query parameter: ?paging={offset},{page_size} . {offset} is the index of the first item to retrieve in the collection. For example, to retrieve the first page of 100 items: ?paging=0,100 . The total number of items across all pages can be retrieved through ?fields=collection.count . | Paging is handled through 2 query parameters: ?limit={page_size} and ?page={page_number} . For example, to retrieve the first page of 100 items: ?limit=100&page=1 . Retrieve the total number of items across all pages through ?fields.root=count . |
Filtering | You can filter out items of a collection by most of their properties. Strict equality with ?{propertyName}={value} or inequality through ?{propertyName}=notequal,{value} . Date comparisons: ?{dateProperty}=since,{date} or ?{dateProperty}=until,{date} or ?{dateProperty}=between,{start},{end} . Numbers comparisons through ?{numberProperty}=greaterthan,{value} or ?{numberProperty}=greaterthanorequal,{value} or ?{numberProperty}=lowerthan,{value} or ?{numberProperty}=lowerthanorequal,{value} . | The only filters that are supported are documented in the API reference as query parameters. |
Sorting | You can sort on most properties through ?orderBy={propertyName},{direction} where {direction} is either "asc" or "desc" . | Identical to the sorting feature in the Lucca API. You can sort on a subset of properties through the ?sort query parameter, those that are documented in the API reference. |
Representations | The representation of the resource is contained in the data property of the root JSON object. Items of a collection are entries of the data.items array. | The representation of the resource is at the root of the JSON object. Items of a collection are entries of the items array. |
Was this page helpful?