LianaCommerce REST API

Categories

Serverhttps://shop.example.com/api/v1

Create, read and update the shop's product categories and their names, descriptions and SEO names in each language. Categories can't be deleted through the API.


List categories

GET
https://shop.example.com/api/v1
/categories

Returns the shop's categories, newest first, with their names. Get a category for its other localized fields. The filters match exact values; an empty filter value is ignored. Deleted categories are not listed.

List categories › query Parameters

limit
​integer · min: 1 · max: 2147483647

The number of items to return. Must be a decimal integer; any other value returns 400. There is no page size cap, but large pages take longer: follow the next link to read a long list.

Default: 20
offset
​integer · min: 0 · max: 2147483647

The number of items to skip. Must be a decimal integer; any other value returns 400.

Default: 0
code
​string

Return the categories with exactly this category code. Case-sensitive.

erp_id
​string

Return the categories with exactly this ERP ID. Case-sensitive.

List categories › Responses

The categories.

Links to the first, previous and next page. Each link carries the request's `limit`, `offset` and filters. At either end of the list the object is still there, with `href` set to `null`.
href
​string

The URL of the request.

Example: https://shop.example.com/api/v1/products
​PageLink
​PageLink
​PageLink
​object[]
​Meta

Create a category

POST
https://shop.example.com/api/v1
/categories

Creates a category. Localized fields are arrays of {language, <field>} objects; elements for a language the shop doesn't use are skipped, and a request with no used language returns 400. After saving, the shop renumbers all category positions and builds the SEO names and links; the response shows the result.

Create a category › Request Body

​object[] · required

The category's name per language. Every language you send in any localized field needs a non-empty name when the category gets that language for the first time.

code
​string | null

null stores an empty string.

Example: coffee-beans
erp_id
​string | null

null stores an empty string.

Example: ERP-CAT-0042
group_name
​string | null

null stores an empty string.

Example:
parent
​integer | null

The ID of an existing category to place this one under, or null for a top level category. A category can't be its own parent.

Example: 12
position
​integer

Orders the category among its siblings: lower comes first. On create, 0 or no value places it last. The shop then renumbers all positions.

Example: 10
secondary_position
​integer | null
hidden
​boolean

Can't be null.

Example: false
visible_in_menu
​boolean

Can't be null.

Example: true
​object[]
​object[]
​object[]
​object[]
​object[]

Used on update only. On create, the shop makes each seo_name from the name.

​object[]

Overwritten. The shop builds seo_links from the seo_names of the category and its parents.

Create a category › Responses

The created category.

href
​string

The URL of the request.

Example: https://shop.example.com/api/v1/products
​object[]

One category.

​Meta

Get a category

GET
https://shop.example.com/api/v1
/categories/{category-id}

Get a category › path Parameters

category-id
​integer · int64 · required

The category's ID. A value that is not a number returns 400; an unknown or deleted category returns 404.

Get a category › Responses

The category.

href
​string

The URL of the request.

Example: https://shop.example.com/api/v1/products
​object[]

One category.

​Meta

Update a category

PUT
https://shop.example.com/api/v1
/categories/{category-id}

Updates the fields you send and keeps the others. In a localized field, a language the category already has gets the values you send and keeps its other values; a new language needs a non-empty name. After saving, the shop renumbers all category positions and rebuilds the SEO links; the response shows the result.

Update a category › path Parameters

category-id
​integer · int64 · required

The category's ID. A value that is not a number returns 400; an unknown or deleted category returns 404.

Update a category › Request Body

​object[]

The category's name per language. Every language you send in any localized field needs a non-empty name when the category gets that language for the first time.

code
​string | null

null stores an empty string.

Example: coffee-beans
erp_id
​string | null

null stores an empty string.

Example: ERP-CAT-0042
group_name
​string | null

null stores an empty string.

Example:
parent
​integer | null

The ID of an existing category to place this one under, or null for a top level category. A category can't be its own parent.

Example: 12
position
​integer

Orders the category among its siblings: lower comes first. On create, 0 or no value places it last. The shop then renumbers all positions.

Example: 10
secondary_position
​integer | null
hidden
​boolean

Can't be null.

Example: false
visible_in_menu
​boolean

Can't be null.

Example: true
​object[]
​object[]
​object[]
​object[]
​object[]

Used on update only. On create, the shop makes each seo_name from the name.

​object[]

Overwritten. The shop builds seo_links from the seo_names of the category and its parents.

Update a category › Responses

The updated category.

href
​string

The URL of the request.

Example: https://shop.example.com/api/v1/products
​object[]

One category.

​Meta