LianaCommerce REST API

Variations

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

Product variations, such as sizes or grinds, with their properties, stock and images, and the variation groups they belong to. Create variations through the product's variations endpoint.


List variations

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

Returns the variations of all products, newest first, without deleted ones. List items leave out color, size, type and properties: get a variation for those. To create a variation, use the product's variations endpoint.

List variations › query Parameters

codes[]
​string[] · style: form · explode: true

Returns variations whose variation_code is one of these codes. The match is exact but ignores case. Repeat the parameter for each code (codes[]=COF-ETH-250-WB&codes[]=COF-ETH-250-G); codes=COF-ETH-250-WB also works for a single code.

eans[]
​string[] · style: form · explode: true

Returns variations whose ean_code is one of these codes. The match is exact but ignores case. Repeat the parameter for each code; eans=6412345678910 also works for a single code.

erp_id
​string

Returns variations with this ERP id (exact match). An empty value is ignored.

hidden
​boolean

true returns only hidden variations, false only visible ones. 1, 0, yes, no, on and off also work; any other value returns 400.

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

List variations › Responses

A page of variations.

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

Get a variation

GET
https://shop.example.com/api/v1
/variations/{variation-id}

Returns one variation with its property values.

Get a variation › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

Get a variation › Responses

The variation.

href
​string

The URL of the request.

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

The variation, as the only element.

​Meta

Update a variation

PUT
https://shop.example.com/api/v1
/variations/{variation-id}

Updates the fields you send and keeps the others. In names and descriptions, languages you leave out keep their stored values. To set the stock of many variations at once, use Update stock in bulk.

Update a variation › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

Update a variation › Request Body

product_id
​integer

Moves the variation to this product. The product must exist and not be deleted, else 400.

Example: 5
group_id
​integer

The variation group. It must exist and not be deleted, else 400.

Example: 3

Names to add or change, one element per language. Languages you leave out keep their stored values. A language the variation has no name for yet needs a non-empty name.

​VariationDescription[]

Descriptions to add or change, one element per language.

additional_price
​number
stock
​integer
color
​string

The color code. The shop may store it as a mapped color code if it has a color mapping for the product's supplier.

Example:
size
​string

The size. The shop may store it as a mapped size if it has a size mapping for the product's supplier.

Example:
type
​string

An empty string or string; any other value returns 400.

Example:
erp_id
​string
variation_code
​string
ean_code
​string
hidden
​boolean
position
​integer

The sort position. 0 is ignored.

Example: 1
visible_out_of_stock
​boolean
buyable_out_of_stock
​boolean

Update a variation › Responses

The updated variation.

href
​string

The URL of the request.

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

The variation, as the only element.

​Meta

Delete a variation

DELETE
https://shop.example.com/api/v1
/variations/{variation-id}

Marks the variation deleted. After that it is left out of lists and its endpoints return 404. The response shows the variation as it was before the delete.

Delete a variation › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

Delete a variation › Responses

The deleted variation.

href
​string

The URL of the request.

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

The variation, as the only element.

​Meta

List a variation's properties

GET
https://shop.example.com/api/v1
/variations/{variation-id}/properties

Returns the variation's property values, newest first.

List a variation's properties › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

List a variation's properties › 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

List a variation's properties › Responses

A page of property values.

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

Add a property to a variation

POST
https://shop.example.com/api/v1
/variations/{variation-id}/properties

Gives the variation a value for a property. The request returns 400 if:

  • the property doesn't exist, has no options, or doesn't apply to variations (property_of_variation);
  • the property isn't available in the product's main category or one of its secondary categories;
  • the variation already has a value for the property (use PUT to change it);
  • option_ids has an option of another property, or more than one option for a property that isn't multichoice.

Add a property to a variation › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

Add a property to a variation › Request Body

property_id
​integer · required

The property to set.

Example: 8
option_ids
​integer[] · minItems: 1 · required

The ids of the property's options to give the variation, at least one; an empty array returns 400. More than one only if the property is multichoice.

Example: [41]

Add a property to a variation › Responses

The variation's new property value.

href
​string

The URL of the request.

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

The property value, as the only element.

​Meta

Get a variation's property

GET
https://shop.example.com/api/v1
/variations/{variation-id}/properties/{variation-property-id}

Returns one property value of the variation.

Get a variation's property › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

variation-property-id
​integer · required

The id of the variation's property value (the id in the variation's property list, not the property's id).

Get a variation's property › Responses

The property value.

href
​string

The URL of the request.

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

The property value, as the only element.

​Meta

Update a variation's property

PUT
https://shop.example.com/api/v1
/variations/{variation-id}/properties/{variation-property-id}

Replaces the options the variation has for this property with option_ids. Every id must be an option of the property, and more than one needs a multichoice property, else 400.

Update a variation's property › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

variation-property-id
​integer · required

The id of the variation's property value (the id in the variation's property list, not the property's id).

Update a variation's property › Request Body

option_ids
​integer[] · required

The full list of option ids the variation should have for this property. Options not in the list are removed; an empty array removes them all. More than one only if the property is multichoice.

Example: [42]

Update a variation's property › Responses

The updated property value.

href
​string

The URL of the request.

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

The property value, as the only element.

​Meta

Remove a property from a variation

DELETE
https://shop.example.com/api/v1
/variations/{variation-id}/properties/{variation-property-id}

Removes the property value and its options from the variation. The property itself is not changed. The response shows the value as it was.

Remove a property from a variation › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

variation-property-id
​integer · required

The id of the variation's property value (the id in the variation's property list, not the property's id).

Remove a property from a variation › Responses

The removed property value.

href
​string

The URL of the request.

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

The property value, as the only element.

​Meta

Get a variation's stock

GET
https://shop.example.com/api/v1
/variations/{variation-id}/stock

Returns the variation's stock and sales counters. To change the stock, use Update a variation or Update stock in bulk.

Get a variation's stock › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

Get a variation's stock › Responses

The variation's stock.

href
​string

The URL of the request.

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

The stock, as the only element.

​Meta

List a variation's stock history

GET
https://shop.example.com/api/v1
/variations/{variation-id}/stock/history

Returns the variation's stock changes, newest first.

List a variation's stock history › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

List a variation's stock history › 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

List a variation's stock history › Responses

A page of stock changes.

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

List variation groups

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

Returns the variation groups, such as size or color, newest first, without deleted ones. A variation belongs to one group (its group_id).

List variation groups › 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

List variation groups › Responses

A page of variation groups.

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 variation group

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

Creates a variation group. names needs at least one element with a non-empty name. Fields you leave out get their defaults.

Create a variation group › Request Body

​VariationGroupName[] · minItems: 1 · required

The group's name per language. Each element needs a non-empty name.

code
​string
Example: SIZE
Default:
required
​boolean
Example: true
Default: false
position
​integer

The group's sort position. If you leave it out or send 0, the group gets 999.

Example: 10
Default: 999
hide_product_if_no_stock
​boolean
Example: false
Default: false

Create a variation group › Responses

The created variation group.

href
​string

The URL of the request.

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

The variation group, as the only element.

​Meta

Get a variation group

GET
https://shop.example.com/api/v1
/variationgroups/{group-id}

Returns one variation group. A deleted group returns 404.

Get a variation group › path Parameters

group-id
​integer · required

The variation group's id.

Get a variation group › Responses

The variation group.

href
​string

The URL of the request.

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

The variation group, as the only element.

​Meta

Update a variation group

PUT
https://shop.example.com/api/v1
/variationgroups/{group-id}

Updates the fields you send and keeps the others. In names, languages you leave out keep their stored values.

Update a variation group › path Parameters

group-id
​integer · required

The variation group's id.

Update a variation group › Request Body

Names to add or change, one element per language. Languages you leave out keep their stored values. A language the group has no name for yet needs a non-empty name.

code
​string
required
​boolean
position
​integer
hide_product_if_no_stock
​boolean

Update a variation group › Responses

The updated variation group.

href
​string

The URL of the request.

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

The variation group, as the only element.

​Meta

List a variation's images

GET
https://shop.example.com/api/v1
/variations/{variation-id}/images

Returns the variation's images, newest first. To add an image, use Upload a variation image.

List a variation's images › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

List a variation's images › 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

List a variation's images › Responses

A page of images.

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

Get a variation image

GET
https://shop.example.com/api/v1
/variations/{variation-id}/images/{image-id}

Returns one image of the variation.

Get a variation image › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

image-id
​integer · required

The image's id. An unknown or deleted image, or an image of another variation, returns 404.

Get a variation image › Responses

The image.

href
​string

The URL of the request.

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

The image, as the only element.

​Meta

Update a variation image

PUT
https://shop.example.com/api/v1
/variations/{variation-id}/images/{image-id}

Updates the fields you send and keeps the others. In titles and descriptions, languages you leave out keep their stored values. is_default and is_teaser set or clear the variation's main and teaser image.

Update a variation image › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

image-id
​integer · required

The image's id. An unknown or deleted image, or an image of another variation, returns 404.

Update a variation image › Request Body

is_default
​boolean

true makes this the variation's main image; false clears the main image if it is this one.

Example: true
is_teaser
​boolean

true makes this the variation's teaser image; false clears the teaser image if it is this one.

Example: false
position
​integer

Titles to add or change, one element per language. Languages you leave out keep their stored values. A language the image has no title for yet needs a non-empty title.

Descriptions to add or change, one element per language.

Update a variation image › Responses

The updated image.

href
​string

The URL of the request.

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

The image, as the only element.

​Meta

Delete a variation image

DELETE
https://shop.example.com/api/v1
/variations/{variation-id}/images/{image-id}

Deletes the image from the variation permanently. If it was the variation's main or teaser image, that is cleared. The response shows the image as it was; is_default and is_teaser tell whether it was the main or teaser image.

Delete a variation image › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

image-id
​integer · required

The image's id. An unknown or deleted image, or an image of another variation, returns 404.

Delete a variation image › Responses

The deleted image.

href
​string

The URL of the request.

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

The image, as the only element.

​Meta

Upload a variation image

POST
https://shop.example.com/api/v1
/variations/{variation-id}/images/upload

Adds an image to the variation. The body is JSON (Content-Type: application/json) in one of two shapes:

  • From a URL: file_url_path with an http(s):// URL of an image on a public host, or img:<id> to reuse an image already in the shop, plus optional titles, descriptions, is_default, is_teaser and position.
  • Base64: only base64, the image file encoded as base64.

If the variation already has an image with the same stored file, no new image is created: the response is the existing image, with is_default: true and is_teaser: true applied. Its is_default and is_teaser show whether it is the variation's main and teaser image after the request. Re-uploading the same base64 bytes is therefore safe.

Upload a variation image › path Parameters

variation-id
​integer · required

The variation's id. A deleted variation returns 404.

Upload a variation image › Request Body

oneOf
Exactly one variant must match.

Decision Table

VariantMatching Criteria
type = object · requires: file_url_path
type = object · requires: base64
Properties for From a URL:
file_url_path
​string · required

An http:// or https:// URL of an image on a public host, or img:<id> to reuse an image that is already in the shop. A refused URL, a failed download or a file that isn't an image returns 400 Parameter 'file_url_path' has invalid value.

Example: https://images.example.com/coffee/ethiopia-250g.jpg

The image's title per language. Without titles, the title is the stored file name, in one language. A language with an empty title is skipped.

The image's description per language.

is_default
​boolean

Makes the image the variation's main image.

Example: true
Default: false
is_teaser
​boolean

Makes the image the variation's teaser image.

Example: false
Default: false
position
​integer

The sort position. If you leave it out or send 0, the image goes last.

Example: 1

Upload a variation image › Responses

The new image, or the existing image with the same file.

href
​string

The URL of the request.

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

The image, as the only element.

​Meta