Sections
Sections are used to group assets within a kit. Each section contains a list of items which are fetched via the section.
for more information on the various types of items and their functions, see Items.
Fetch a Section
Return a single section and the items within it. Items may be paged using the page
and limit
parameters.
const section = lingo.fetchSection("<sectionID>", 0);
console.log(`${section.name} has ${section.items.length} items`);
Arguments
sectionId
string • required
The uuid for the section to fetch.
version
Number
The version of the section/kit to fetch. (default 0)
page
Number
The page number to retrieve when paging through results (default 1).
limit
Number
The max number of items to retrieve, up to 200 or 0 for no items (default 50).
Section Properties
id
string
The unique identifier for the kit
version
number
The numeric version the section belongs to.
name
string
The name of the section.
displayOrder
number
A relative order of the section in the version.
items
Item[]
A list of items in the section. Items may be paged depending on request options.
Fetch all items
Retrieve the outline of a kit. The outline includes the version information along with a list of sections and headers within each section.
const items = await lingo.fetchAllItemsInSection("<page.sectionID>", 0);
Arguments
sectionId
string • required
The uuid for the section to fetch.
version
number
The version of the section/kit to fetch. (default 0)
Fetch header items
Retrieve the items within a section that fall under a particular heading.
const items = await lingo.fetchItemsForHeading("<sectionID>", "<headerID>");
Arguments
sectionId
string • required
The uuid for the section to fetch.
headingId
string • required
The id or name of the section. Note that with name, the first match is used.
version
number
The version of the section/kit to query. (default 0)
Create a section
Creating content requires an API token with write access enabled.
Create a new section.
const section = await lingo.createSection("<KitID>", "My Section");
Arguments
kitId
string • required
The id of the kit to create the section in.
name
string • required
The name for the new section.