LianaCommerce REST API

Roles

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

Customer roles, such as wholesale customers. Discounts and prices can target a role.


List roles

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

Returns the shop's customer roles, newest first.

List roles › 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 roles › Responses

A page of roles.

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 role

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

Creates a customer role. labels needs at least one element with a non-empty label.

Create a role › Request Body

name
​string · required

The role's internal name.

Example: wholesale
​RoleLabel[] · minItems: 1 · required

The display name per language. Each element needs a non-empty label.

code
​string | null

Your own code for the role. null sets an empty string.

Example: WHOLESALE
Default:
​RoleDescription[]

The description per language.

Create a role › Responses

The created role.

href
​string

The URL of the request.

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

The role, as the only element.

​Meta

Get a role

GET
https://shop.example.com/api/v1
/roles/{role-id}

Returns one customer role.

Get a role › path Parameters

role-id
​integer · required

The role's id.

Get a role › Responses

The role.

href
​string

The URL of the request.

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

The role, as the only element.

​Meta

Update a role

PUT
https://shop.example.com/api/v1
/roles/{role-id}

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

Update a role › path Parameters

role-id
​integer · required

The role's id.

Update a role › Request Body

name
​string

The role's internal name.

Example: wholesale
code
​string | null

Your own code for the role. null sets an empty string.

Example: WHOLESALE
​RoleLabel[]

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

​RoleDescription[]

Descriptions to add or change, one element per language.

Update a role › Responses

The updated role.

href
​string

The URL of the request.

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

The role, as the only element.

​Meta