LianaCommerce REST API

Accounts

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

Create, read and update the shop's customer accounts. The API can't delete accounts or give or remove admin roles.


List accounts

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

Returns the shop's customer accounts, newest first. The filters match exact values; an empty filter value is ignored. Deleted accounts are not listed.

List accounts › 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
customer_number
​string

Return the accounts with exactly this customer number. Case-sensitive.

email
​string

Return the account with this email address. The match ignores case.

reference
​string

Return the accounts with exactly this reference. Case-sensitive.

credits
​number

Return the accounts whose credit balance is exactly this amount. 0 also matches the accounts that have never had credits.

List accounts › Responses

The accounts.

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 an account

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

Creates a customer account. The API sends the customer no email, and the account has no usable password: the customer sets one with the shop's password reset before logging in. Fields you omit get their defaults: empty strings, false, pays_vat default and no credits. Text fields accept null and store an empty string.

Create an account › Request Body

name
​string · required

The customer's name. Can't be null; on create it can't be a number.

Example: Maija Virtanen
email
​string · required

A valid email address that no other account uses, ignoring case. The shop saves it in lowercase. Can't be null.

Example: maija.virtanen@example.com
role_id
​integer · required

The ID of an existing customer role, see List roles. Admin roles return 400 Insufficient rights, and so does moving an account out of an admin role. Can't be null.

Example: 3
customer_number
​string | null
street
​string | null
street2
​string | null
postal_code
​string | null
city
​string | null
state
​string | null
county
​string | null
country_id
​integer | null

The ID of a delivery country, see List countries. Sets country_name and country_code too. null removes the country.

Example: 72
phone_number
​string | null
company
​string | null
vat_number
​string | null
public_language
​string | null

One of the shop's languages, a two-letter code such as FI. Other values return 400.

Example: FI
gender
​string | null · enum

m, f, x (prefers not to say), or an empty string or null for unknown.

Enum values:
m
f
x
Example: f
birthdate
​string | null · date

An ISO 8601 date. A date-time is accepted too; only the date is stored.

Example: 1988-05-21
email_promotion_allowed
​boolean

Can't be null.

Example: true
mail_promotion_allowed
​boolean

Can't be null.

Example: false
sms_promotion_allowed
​boolean

Can't be null.

Example: false
pays_vat
​string | null · enum

default follows the shop's VAT setting, yes and no override it. An empty string or null means default.

Enum values:
default
yes
no
Example: default
reference
​string | null
credits
​number

Sets the account's credit balance to this amount (it does not add to it). Can't be null.

Example: 25.5
extra_data_1
​string | null
extra_data_2
​string | null
extra_data_3
​string | null

Create an account › Responses

The created account.

href
​string

The URL of the request.

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

One account.

​Meta

Get an account

GET
https://shop.example.com/api/v1
/accounts/{account-id}

Get an account › path Parameters

account-id
​integer · int64 · required

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

Get an account › Responses

The account.

href
​string

The URL of the request.

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

One account.

​Meta

Update an account

PUT
https://shop.example.com/api/v1
/accounts/{account-id}

Updates the fields you send and keeps the others. Text fields accept null and store an empty string; country_id and birthdate accept null to clear them. credits replaces the balance.

Update an account › path Parameters

account-id
​integer · int64 · required

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

Update an account › Request Body

name
​string

The customer's name. Can't be null; on create it can't be a number.

Example: Maija Virtanen
email
​string

A valid email address that no other account uses, ignoring case. The shop saves it in lowercase. Can't be null.

Example: maija.virtanen@example.com
role_id
​integer

The ID of an existing customer role, see List roles. Admin roles return 400 Insufficient rights, and so does moving an account out of an admin role. Can't be null.

Example: 3
customer_number
​string | null
street
​string | null
street2
​string | null
postal_code
​string | null
city
​string | null
state
​string | null
county
​string | null
country_id
​integer | null

The ID of a delivery country, see List countries. Sets country_name and country_code too. null removes the country.

Example: 72
phone_number
​string | null
company
​string | null
vat_number
​string | null
public_language
​string | null

One of the shop's languages, a two-letter code such as FI. Other values return 400.

Example: FI
gender
​string | null · enum

m, f, x (prefers not to say), or an empty string or null for unknown.

Enum values:
m
f
x
Example: f
birthdate
​string | null · date

An ISO 8601 date. A date-time is accepted too; only the date is stored.

Example: 1988-05-21
email_promotion_allowed
​boolean

Can't be null.

Example: true
mail_promotion_allowed
​boolean

Can't be null.

Example: false
sms_promotion_allowed
​boolean

Can't be null.

Example: false
pays_vat
​string | null · enum

default follows the shop's VAT setting, yes and no override it. An empty string or null means default.

Enum values:
default
yes
no
Example: default
reference
​string | null
credits
​number

Sets the account's credit balance to this amount (it does not add to it). Can't be null.

Example: 25.5
extra_data_1
​string | null
extra_data_2
​string | null
extra_data_3
​string | null

Update an account › Responses

The updated account.

href
​string

The URL of the request.

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

One account.

​Meta