LianaCMS REST API

Batch

Serverhttps://example.lianacms.com/api/v3

Create or update many users, contacts, news items, events or products in one request, processed by a background job.


Create users in a batch

POST
https://example.lianacms.com/api/v3
/batch/users
  • The body is a JSON array of users; an empty body returns 400. The users are processed by a background job: the response is 202 with href pointing to /job_queue/{job-queue-id}. Poll it; when the job is done it redirects to /batch/users/{job-queue-id}, which lists the rejected elements.
  • Each element is validated as in POST /users; password is required, and a username repeated within the batch makes the later element invalid.
  • Unknown fields make an element invalid (the single-item endpoints ignore them). Invalid elements are skipped and the valid ones are written. If no element is valid, the whole job fails with message Invalid request body.
  • The rights are checked again when the job runs; if they are missing then, the job fails.
  • No limit on the number of elements is enforced.
  • No module check.
  • Requires the users_modify permission in at least one group of this site, otherwise 403.

Create users in a batch › Request Body

Profile fields of the Account module. They are returned, and written, only when the Account module is enabled; otherwise they are accepted in requests but ignored. A field without a value is returned as null. In PATCH null clears a field; POST refuses null.
groups
​integer[] · minItems: 1 · required

Ids of the groups the user is a member of. In a request every group must exist and be one the caller may assign (see Create a user). In PATCH the list replaces the memberships; an empty list is ignored. The user's primary group is set to the first group listed.

Example: [3,5]
username
​string · required

Unique, compared without regard to case.

Example: user21
email
​string · required

Must be a valid email address. Uniqueness is not checked.

Example: john.tester@example.com
name
​string · required

Display name.

Example: John Tester
password
​string · minLength: 8 · required

Plaintext password, at least 8 bytes. It is stored only as a hash and never returned. When a user is created without one, the CMS generates a random 15-character password. Changing the password ends the user's sessions.

Example: correct-horse-battery
active
​boolean

Defaults to true when a user is created.

Example: true
valid_to
​string | null · date-time

Expiry time of the account. Takes ISO 8601 (a date alone is accepted). Null clears it in PATCH; POST refuses null.

Example: 2045-02-04T05:24:28+02:00
firstname
​string | null
lastname
​string | null
birthdate
​string | null · date-time

Takes ISO 8601 (a date alone is accepted); returned as a date-time.

Example: 1947-02-04T00:00:00+02:00
city
​string | null
address1
​string | null
address2
​string | null
address3
​string | null
address4
​string | null
postalcode
​string | null
description
​string | null
avatar
​string | null
extra1
​string | null
extra2
​string | null
extra3
​string | null
sex
​string | null · enum
Enum values:
m
f
Example: m
phone
​string | null
company_name
​string | null
company_code
​string | null
company_address
​string | null
company_city
​string | null
company_postalcode
​string | null
company_phone
​string | null
company_www
​string | null
company_field
​string | null
company_size
​string | null
company_state
​string | null
company_country
​string | null
some1
​string | null
some2
​string | null
some3
​string | null

Create users in a batch › Responses

Accepted. The job was started; href is the job queue URL to poll.

The job that was started. `href` is the job queue resource (/job_queue/{job-queue-id}) to poll for its progress.
href
​string
​object
​Meta

Update users in a batch

PATCH
https://example.lianacms.com/api/v3
/batch/users
  • The body is a JSON array of users; an empty body returns 400. The users are processed by a background job: the response is 202 with href pointing to /job_queue/{job-queue-id}. Poll it; when the job is done it redirects to /batch/users/{job-queue-id}, which lists the rejected elements.
  • Each element needs id and is validated as in PATCH /users/{user-id}. An id that does not exist, a user outside the groups the token user may manage, an id repeated within the batch, or a username repeated within the batch makes the element invalid.
  • Unknown fields make an element invalid (the single-item endpoints ignore them). Invalid elements are skipped and the valid ones are written. If no element is valid, the whole job fails with message Invalid request body.
  • The rights are checked again when the job runs; if they are missing then, the job fails.
  • No limit on the number of elements is enforced.
  • No module check.
  • Requires the users_modify permission in at least one group of this site, otherwise 403.

Update users in a batch › Request Body

Profile fields of the Account module. They are returned, and written, only when the Account module is enabled; otherwise they are accepted in requests but ignored. A field without a value is returned as null. In PATCH null clears a field; POST refuses null.
id
​integer · int64 · required
groups
​integer[] · minItems: 1

Ids of the groups the user is a member of. In a request every group must exist and be one the caller may assign (see Create a user). In PATCH the list replaces the memberships; an empty list is ignored. The user's primary group is set to the first group listed.

Example: [3,5]
username
​string

Unique, compared without regard to case.

Example: user21
email
​string

Must be a valid email address. Uniqueness is not checked.

Example: john.tester@example.com
name
​string

Display name.

Example: John Tester
active
​boolean

Defaults to true when a user is created.

Example: true
valid_to
​string | null · date-time

Expiry time of the account. Takes ISO 8601 (a date alone is accepted). Null clears it in PATCH; POST refuses null.

Example: 2045-02-04T05:24:28+02:00
password
​string · minLength: 8

Plaintext password, at least 8 bytes. It is stored only as a hash and never returned. When a user is created without one, the CMS generates a random 15-character password. Changing the password ends the user's sessions.

Example: correct-horse-battery
firstname
​string | null
lastname
​string | null
birthdate
​string | null · date-time

Takes ISO 8601 (a date alone is accepted); returned as a date-time.

Example: 1947-02-04T00:00:00+02:00
city
​string | null
address1
​string | null
address2
​string | null
address3
​string | null
address4
​string | null
postalcode
​string | null
description
​string | null
avatar
​string | null
extra1
​string | null
extra2
​string | null
extra3
​string | null
sex
​string | null · enum
Enum values:
m
f
Example: m
phone
​string | null
company_name
​string | null
company_code
​string | null
company_address
​string | null
company_city
​string | null
company_postalcode
​string | null
company_phone
​string | null
company_www
​string | null
company_field
​string | null
company_size
​string | null
company_state
​string | null
company_country
​string | null
some1
​string | null
some2
​string | null
some3
​string | null

Update users in a batch › Responses

Accepted. The job was started; href is the job queue URL to poll.

The job that was started. `href` is the job queue resource (/job_queue/{job-queue-id}) to poll for its progress.
href
​string
​object
​Meta

Get the result of a users batch job

GET
https://example.lianacms.com/api/v3
/batch/users/{job-queue-id}

Returns the outcome of a batch job started with POST or PATCH /batch/users, always with status 200.

  • When the job has completed, items lists the rejected elements as they were given (the fields password, unhashed_password, ssn and iban are replaced with [REDACTED]) and errors says why each was rejected, in the same order. Both are empty arrays when every element was written.
  • When the whole job failed, status is given instead, with state failed, the reason in message and the per-element errors.
  • A job with a status but not yet completed gives status with state processing. Batch jobs write their status only when they finish, so a running job is not found yet (404).
  • An id that is not 1 to 64 letters, digits, _ or - returns 400. An unknown job, one whose status is older than 24 hours, or a job of another batch resource returns 404.
  • No module check. No other permission is checked, and the job does not have to be the user's own.

Get the result of a users batch job › path Parameters

job-queue-id
​string · pattern: ^[A-Za-z0-9_-]{1,64}… · required

Id of the job, as given in the href of the POST or PATCH response: 1 to 64 letters, digits, _ or -. Any other id returns 400.

Get the result of a users batch job › Responses

OK

href
​string
​object[]

Why each rejected element was rejected, in the same order as items.

Present instead of items while the job is processing (state 'processing', without errors) or when the whole job failed (state 'failed', with message and errors). Both are returned with HTTP 200.

​Meta

Create products in a batch

POST
https://example.lianacms.com/api/v3
/batch/products
  • The body is a JSON array of products; an empty body returns 400. The products are processed by a background job: the response is 202 with href pointing to /job_queue/{job-queue-id}. Poll it; when the job is done it redirects to /batch/products/{job-queue-id}, which lists the rejected elements.
  • Each element is validated as in POST /products.
  • Unknown fields make an element invalid (the single-item endpoints ignore them). Invalid elements are skipped and the valid ones are written. If no element is valid, the whole job fails with message Invalid request body.
  • The rights are checked again when the job runs; if they are missing then, the job fails.
  • No limit on the number of elements is enforced.
  • Requires the Products module to be enabled and accessible to the user, otherwise 403.
  • Requires the products_modify or products_delete permission or membership in group 1, otherwise 403. (products_import, which is enough for POST /products, is not enough here.)

Create products in a batch › Request Body

​Translations · required

Product name per language, keyed by language code. On input every key must be a language of the site (case-insensitive) and every value a string, otherwise 400.

Example: {"FI":"Tuotteet","EN":"Products"}
categories
​array | null · required

Category ids. Every id must be a category the user may use (400). On update the list replaces the current categories. In responses to GET only the categories the user may view are listed; the list is null when there are none.

Example: [4,3]
commenting
​CommentingTypes · enum
Enum values:
public
registered
none
Default: public
owner
​integer

User id of the owner. Must be an existing user (400). Defaults to the token's user on create.

Example: 54
valid_from
​string | null · date-time

ISO 8601. Must not be later than valid_to (400). null clears it on update.

Example: 2045-02-04T05:24:28+02:00
valid_to
​string | null · date-time

ISO 8601. null clears it on update.

Example: 2050-02-04T05:24:28+02:00
visibility
​VisibilityTypes · enum
Enum values:
public
private
registered
hidden
Default: public
​array | null

On update, each element replaces the values of that property in that language and null deletes all properties of the product.

Create products in a batch › Responses

Accepted. The job was started; href is the job queue URL to poll.

The job that was started. `href` is the job queue resource (/job_queue/{job-queue-id}) to poll for its progress.
href
​string
​object
​Meta

Update products in a batch

PATCH
https://example.lianacms.com/api/v3
/batch/products
  • The body is a JSON array of products; an empty body returns 400. The products are processed by a background job: the response is 202 with href pointing to /job_queue/{job-queue-id}. Poll it; when the job is done it redirects to /batch/products/{job-queue-id}, which lists the rejected elements.
  • Each element needs id and is validated as in PATCH /products/{product-id}. An id that does not exist, a product in a category the user may not use, or an id repeated within the batch makes the element invalid.
  • Unknown fields make an element invalid (the single-item endpoints ignore them). Invalid elements are skipped and the valid ones are written. If no element is valid, the whole job fails with message Invalid request body.
  • The rights are checked again when the job runs; if they are missing then, the job fails.
  • No limit on the number of elements is enforced.
  • Requires the Products module to be enabled and accessible to the user, otherwise 403.
  • Requires the products_modify or products_delete permission or membership in group 1, otherwise 403. (products_import, which is enough for POST /products, is not enough here.)

Update products in a batch › Request Body

id
​integer · int64 · required
​Translations

Product name per language, keyed by language code. On input every key must be a language of the site (case-insensitive) and every value a string, otherwise 400.

Example: {"FI":"Tuotteet","EN":"Products"}
commenting
​CommentingTypes · enum
Enum values:
public
registered
none
Default: public
owner
​integer

User id of the owner. Must be an existing user (400). Defaults to the token's user on create.

Example: 54
valid_from
​string | null · date-time

ISO 8601. Must not be later than valid_to (400). null clears it on update.

Example: 2045-02-04T05:24:28+02:00
valid_to
​string | null · date-time

ISO 8601. null clears it on update.

Example: 2050-02-04T05:24:28+02:00
visibility
​VisibilityTypes · enum
Enum values:
public
private
registered
hidden
Default: public
categories
​array | null

Category ids. Every id must be a category the user may use (400). On update the list replaces the current categories. In responses to GET only the categories the user may view are listed; the list is null when there are none.

Example: [4,3]
​array | null

On update, each element replaces the values of that property in that language and null deletes all properties of the product.

Update products in a batch › Responses

Accepted. The job was started; href is the job queue URL to poll.

The job that was started. `href` is the job queue resource (/job_queue/{job-queue-id}) to poll for its progress.
href
​string
​object
​Meta

Get the result of a products batch job

GET
https://example.lianacms.com/api/v3
/batch/products/{job-queue-id}

Returns the outcome of a batch job started with POST or PATCH /batch/products, always with status 200.

  • When the job has completed, items lists the rejected elements as they were given (the fields password, unhashed_password, ssn and iban are replaced with [REDACTED]) and errors says why each was rejected, in the same order. Both are empty arrays when every element was written.
  • When the whole job failed, status is given instead, with state failed, the reason in message and the per-element errors.
  • A job with a status but not yet completed gives status with state processing. Batch jobs write their status only when they finish, so a running job is not found yet (404).
  • An id that is not 1 to 64 letters, digits, _ or - returns 400. An unknown job, one whose status is older than 24 hours, or a job of another batch resource returns 404.
  • Requires the Products module to be enabled and accessible to the user, otherwise 403. No other permission is checked, and the job does not have to be the user's own.

Get the result of a products batch job › path Parameters

job-queue-id
​string · pattern: ^[A-Za-z0-9_-]{1,64}… · required

Id of the job, as given in the href of the POST or PATCH response: 1 to 64 letters, digits, _ or -. Any other id returns 400.

Get the result of a products batch job › Responses

OK

href
​string
​object[]

Why each rejected element was rejected, in the same order as items.

Present instead of items while the job is processing (state 'processing', without errors) or when the whole job failed (state 'failed', with message and errors). Both are returned with HTTP 200.

​Meta

Create contacts in a batch

POST
https://example.lianacms.com/api/v3
/batch/contacts
  • The body is a JSON array of contacts; an empty body returns 400. The contacts are processed by a background job: the response is 202 with href pointing to /job_queue/{job-queue-id}. Poll it; when the job is done it redirects to /batch/contacts/{job-queue-id}, which lists the rejected elements.
  • Each element is validated as in POST /contacts.
  • Unknown fields make an element invalid (the single-item endpoints ignore them). Invalid elements are skipped and the valid ones are written. If no element is valid, the whole job fails with message Invalid request body.
  • The rights are checked again when the job runs; if they are missing then, the job fails.
  • No limit on the number of elements is enforced.
  • Requires the Contacts module to be enabled, otherwise 403.
  • Requires the contacts_modify or contacts_import permission or membership in group 1, otherwise 403.

Create contacts in a batch › Request Body

oneOf
Exactly one variant must match.

Decision Table

VariantMatching Criteria
type = object · requires: firstname, lastname, categories
type = object · requires: type, names, categories
Properties for Variant 1:
firstname
​string · required

Person contacts only; ignored for organizations.

Example: John
lastname
​string · required

Person contacts only; ignored for organizations.

Example: Tester
categories
​integer[] · minItems: 1 · required

Ids of contact categories (under the contacts root category) on which the caller's group has admin rights, with the categories right. Any other id returns 400. In PATCH the list replaces the categories and the property values of removed categories are deleted; an empty list is ignored.

Example: [3,4]
type
​string · enum
Enum values:
person
Default: person
owner
​integer

Id of an existing user who is not deleted. Defaults to the caller when a contact is created.

Example: 54
valid_from
​string · date-time

ISO 8601. Must not be later than valid_to when both are given.

Example: 2045-02-04T05:24:28+02:00
valid_to
​string · date-time

ISO 8601.

Example: 2050-02-04T05:24:28+02:00
visibility
​VisibilityTypes · enum
Enum values:
public
private
registered
hidden
Default: public
​ContactProperties[]

Property values to set. Each entry replaces the values of that property in that language. The property must belong to a category of the contact. In PATCH null deletes every property value of the contact. Values of keyvalue properties cannot be written.

Create contacts in a batch › Responses

Accepted. The job was started; href is the job queue URL to poll.

The job that was started. `href` is the job queue resource (/job_queue/{job-queue-id}) to poll for its progress.
href
​string
​object
​Meta

Update contacts in a batch

PATCH
https://example.lianacms.com/api/v3
/batch/contacts
  • The body is a JSON array of contacts; an empty body returns 400. The contacts are processed by a background job: the response is 202 with href pointing to /job_queue/{job-queue-id}. Poll it; when the job is done it redirects to /batch/contacts/{job-queue-id}, which lists the rejected elements.
  • Each element needs id and is validated as in PATCH /contacts/{contact-id}. An id that does not exist, a contact the user has no rights to, or an id repeated within the batch makes the element invalid.
  • Unknown fields make an element invalid (the single-item endpoints ignore them). Invalid elements are skipped and the valid ones are written. If no element is valid, the whole job fails with message Invalid request body.
  • The rights are checked again when the job runs; if they are missing then, the job fails.
  • No limit on the number of elements is enforced.
  • Requires the Contacts module to be enabled, otherwise 403.
  • Requires the contacts_modify or contacts_import permission or membership in group 1, otherwise 403.

Update contacts in a batch › Request Body

Fields of `PATCH /contacts/{contact-id}` plus the required `id`. Person fields (firstname, lastname) and organization fields (names) depend on the contact's type.
id
​integer · int64 · required
anyOf
At least one variant must match. Multiple variants may match simultaneously.

Decision Table

VariantMatching Criteria
type = object
type = object
Properties for Variant 1:
firstname
​string

Person contacts only; ignored for organizations.

Example: John
lastname
​string

Person contacts only; ignored for organizations.

Example: Tester
type
​string · enum
Enum values:
person
Default: person
owner
​integer

Id of an existing user who is not deleted. Defaults to the caller when a contact is created.

Example: 54
valid_from
​string · date-time

ISO 8601. Must not be later than valid_to when both are given.

Example: 2045-02-04T05:24:28+02:00
valid_to
​string · date-time

ISO 8601.

Example: 2050-02-04T05:24:28+02:00
visibility
​VisibilityTypes · enum
Enum values:
public
private
registered
hidden
Default: public
categories
​integer[] · minItems: 1

Ids of contact categories (under the contacts root category) on which the caller's group has admin rights, with the categories right. Any other id returns 400. In PATCH the list replaces the categories and the property values of removed categories are deleted; an empty list is ignored.

Example: [3,4]
​ContactProperties[]

Property values to set. Each entry replaces the values of that property in that language. The property must belong to a category of the contact. In PATCH null deletes every property value of the contact. Values of keyvalue properties cannot be written.

Update contacts in a batch › Responses

Accepted. The job was started; href is the job queue URL to poll.

The job that was started. `href` is the job queue resource (/job_queue/{job-queue-id}) to poll for its progress.
href
​string
​object
​Meta

Get the result of a contacts batch job

GET
https://example.lianacms.com/api/v3
/batch/contacts/{job-queue-id}

Returns the outcome of a batch job started with POST or PATCH /batch/contacts, always with status 200.

  • When the job has completed, items lists the rejected elements as they were given (the fields password, unhashed_password, ssn and iban are replaced with [REDACTED]) and errors says why each was rejected, in the same order. Both are empty arrays when every element was written.
  • When the whole job failed, status is given instead, with state failed, the reason in message and the per-element errors.
  • A job with a status but not yet completed gives status with state processing. Batch jobs write their status only when they finish, so a running job is not found yet (404).
  • An id that is not 1 to 64 letters, digits, _ or - returns 400. An unknown job, one whose status is older than 24 hours, or a job of another batch resource returns 404.
  • Requires the Contacts module to be enabled, otherwise 403. No other permission is checked, and the job does not have to be the user's own.

Get the result of a contacts batch job › path Parameters

job-queue-id
​string · pattern: ^[A-Za-z0-9_-]{1,64}… · required

Id of the job, as given in the href of the POST or PATCH response: 1 to 64 letters, digits, _ or -. Any other id returns 400.

Get the result of a contacts batch job › Responses

OK

href
​string
​object[]

Why each rejected element was rejected, in the same order as items.

Present instead of items while the job is processing (state 'processing', without errors) or when the whole job failed (state 'failed', with message and errors). Both are returned with HTTP 200.

​Meta

Create news items in a batch

POST
https://example.lianacms.com/api/v3
/batch/news
  • The body is a JSON array of news items; an empty body returns 400. The news items are processed by a background job: the response is 202 with href pointing to /job_queue/{job-queue-id}. Poll it; when the job is done it redirects to /batch/news/{job-queue-id}, which lists the rejected elements.
  • Each element is validated as in POST /news.
  • Unknown fields make an element invalid (the single-item endpoints ignore them). Invalid elements are skipped and the valid ones are written. If no element is valid, the whole job fails with message Invalid request body.
  • The rights are checked again when the job runs; if they are missing then, the job fails.
  • No limit on the number of elements is enforced.
  • Requires the News module to be enabled and accessible to the user, otherwise 403.
  • Requires the sitenews_modify permission or membership in group 1, otherwise 403.

Create news items in a batch › Request Body

Creates one language version per key of `translations`, linked to each other as versions of one item. Every other map may only have keys that are in `translations`. Language codes are upper case.
​object · required

Title per language; at least one.

Example: {"FI":"Uutinen","EN":"News"}
​object · required

Category ids per language. Every language of translations needs at least one category that has a name in that language; categories without a name in the language are not linked to that version. Every id must be a news category the user can administer.

Example: {"FI":[15,12],"EN":[15,10]}
​object
​object
​object

Commenting per language; public when not given.

Example: {"FI":"public","EN":"none"}
​object

Owner user id per language, as a JSON integer; the current user when not given. The user must exist and not be deleted.

Example: {"FI":54,"EN":57}
​object

Start of validity per language (ISO 8601).

Example: {"FI":"2045-02-04T05:24:28Z","EN":"2045-02-04T05:24:28Z"}
​object

End of validity per language (ISO 8601); must not be before valid_froms of the same language.

Example: {"FI":"2054-02-04T05:24:28Z","EN":"2047-02-04T05:24:28Z"}
​object

Visibility per language; public when not given.

Example: {"FI":"hidden","EN":"public"}
​NewsProperties[]

Create news items in a batch › Responses

Accepted. The job was started; href is the job queue URL to poll.

The job that was started. `href` is the job queue resource (/job_queue/{job-queue-id}) to poll for its progress.
href
​string
​object
​Meta

Update news items in a batch

PATCH
https://example.lianacms.com/api/v3
/batch/news
  • The body is a JSON array of news items; an empty body returns 400. The news items are processed by a background job: the response is 202 with href pointing to /job_queue/{job-queue-id}. Poll it; when the job is done it redirects to /batch/news/{job-queue-id}, which lists the rejected elements.
  • Each element needs id and is validated as in PATCH /news/{news-id}. An id that does not exist, a news item the user has no rights to, or an id repeated within the batch makes the element invalid.
  • Unknown fields make an element invalid (the single-item endpoints ignore them). Invalid elements are skipped and the valid ones are written. If no element is valid, the whole job fails with message Invalid request body.
  • The rights are checked again when the job runs; if they are missing then, the job fails.
  • No limit on the number of elements is enforced.
  • Requires the News module to be enabled and accessible to the user, otherwise 403.
  • Requires the sitenews_modify permission or membership in group 1, otherwise 403.

Update news items in a batch › Request Body

Fields to change in one language version; fields left out are kept.
id
​integer · int64 · required
translation
​string

Title.

Example: Uutinen
intro
​string | null
body
​string | null
commenting
​string · enum
Enum values:
public
none
owner
​string

Owner user id as a JSON string (an integer is refused). The user must exist and not be deleted.

Example: 54
valid_from
​string | null · date-time
valid_to
​string | null · date-time
visibility
​string · enum
Enum values:
public
hidden
categories
​integer[]

The complete new set of category ids; each must be a news category the user can administer. Values of properties that belong to removed categories are deleted.

Example: [3,4]
​array | null

Property values to replace. null deletes all property values of the item.

Update news items in a batch › Responses

Accepted. The job was started; href is the job queue URL to poll.

The job that was started. `href` is the job queue resource (/job_queue/{job-queue-id}) to poll for its progress.
href
​string
​object
​Meta

Get the result of a news batch job

GET
https://example.lianacms.com/api/v3
/batch/news/{job-queue-id}

Returns the outcome of a batch job started with POST or PATCH /batch/news, always with status 200.

  • When the job has completed, items lists the rejected elements as they were given (the fields password, unhashed_password, ssn and iban are replaced with [REDACTED]) and errors says why each was rejected, in the same order. Both are empty arrays when every element was written.
  • When the whole job failed, status is given instead, with state failed, the reason in message and the per-element errors.
  • A job with a status but not yet completed gives status with state processing. Batch jobs write their status only when they finish, so a running job is not found yet (404).
  • An id that is not 1 to 64 letters, digits, _ or - returns 400. An unknown job, one whose status is older than 24 hours, or a job of another batch resource returns 404.
  • Requires the News module to be enabled and accessible to the user, otherwise 403. No other permission is checked, and the job does not have to be the user's own.

Get the result of a news batch job › path Parameters

job-queue-id
​string · pattern: ^[A-Za-z0-9_-]{1,64}… · required

Id of the job, as given in the href of the POST or PATCH response: 1 to 64 letters, digits, _ or -. Any other id returns 400.

Get the result of a news batch job › Responses

OK

href
​string
​object[]

Why each rejected element was rejected, in the same order as items.

Present instead of items while the job is processing (state 'processing', without errors) or when the whole job failed (state 'failed', with message and errors). Both are returned with HTTP 200.

​Meta

Create events in a batch

POST
https://example.lianacms.com/api/v3
/batch/events
  • The body is a JSON array of events; an empty body returns 400. The events are processed by a background job: the response is 202 with href pointing to /job_queue/{job-queue-id}. Poll it; when the job is done it redirects to /batch/events/{job-queue-id}, which lists the rejected elements.
  • Each element is validated as in POST /events.
  • Unknown fields make an element invalid (the single-item endpoints ignore them). Invalid elements are skipped and the valid ones are written. If no element is valid, the whole job fails with message Invalid request body.
  • The rights are checked again when the job runs; if they are missing then, the job fails.
  • No limit on the number of elements is enforced.
  • Requires the Calendar module to be enabled and accessible to the user, otherwise 403.
  • Requires the events_modify permission or membership in group 1, otherwise 403.

Create events in a batch › Request Body

Creates one language version per key of `translations`, linked to each other as versions of one item. Every other map may only have keys that are in `translations`. Language codes are upper case.
​object · required

Title per language; at least one.

Example: {"FI":"Tapahtuma","EN":"Event"}
​object · required

Category ids per language. Every language of translations needs at least one category that has a name in that language; categories without a name in the language are not linked to that version. Every id must be an event category the user can administer.

Example: {"FI":[15,12],"EN":[15,10]}
​object
​object
​object

Commenting per language; public when not given.

Example: {"FI":"public","EN":"none"}
​object

Owner user id per language, as a JSON integer; the current user when not given. The user must exist and not be deleted.

Example: {"FI":54,"EN":57}
​object

Start of validity per language (ISO 8601).

Example: {"FI":"2045-02-04T05:24:28Z","EN":"2045-02-04T05:24:28Z"}
​object

End of validity per language (ISO 8601); must not be before valid_froms of the same language.

Example: {"FI":"2054-02-04T05:24:28Z","EN":"2047-02-04T05:24:28Z"}
​object

Visibility per language; public when not given.

Example: {"FI":"hidden","EN":"public"}
​EventProperties[]

Create events in a batch › Responses

Accepted. The job was started; href is the job queue URL to poll.

The job that was started. `href` is the job queue resource (/job_queue/{job-queue-id}) to poll for its progress.
href
​string
​object
​Meta

Update events in a batch

PATCH
https://example.lianacms.com/api/v3
/batch/events
  • The body is a JSON array of events; an empty body returns 400. The events are processed by a background job: the response is 202 with href pointing to /job_queue/{job-queue-id}. Poll it; when the job is done it redirects to /batch/events/{job-queue-id}, which lists the rejected elements.
  • Each element needs id and is validated as in PATCH /events/{event-id}. An id that does not exist, an event the user has no rights to, or an id repeated within the batch makes the element invalid.
  • Unknown fields make an element invalid (the single-item endpoints ignore them). Invalid elements are skipped and the valid ones are written. If no element is valid, the whole job fails with message Invalid request body.
  • The rights are checked again when the job runs; if they are missing then, the job fails.
  • No limit on the number of elements is enforced.
  • Requires the Calendar module to be enabled and accessible to the user, otherwise 403.
  • Requires the events_modify permission or membership in group 1, otherwise 403.

Update events in a batch › Request Body

Fields to change in one language version; fields left out are kept.
id
​integer · int64 · required
translation
​string

Title.

Example: Tapahtuma
intro
​string | null
body
​string | null
commenting
​string · enum
Enum values:
public
none
owner
​string

Owner user id as a JSON string (an integer is refused). The user must exist and not be deleted.

Example: 54
valid_from
​string | null · date-time
valid_to
​string | null · date-time
visibility
​string · enum
Enum values:
public
hidden
categories
​integer[]

The complete new set of category ids; each must be an event category the user can administer. Values of properties that belong to removed categories are deleted.

Example: [3,4]
​array | null

Property values to replace. null deletes all property values of the item.

Update events in a batch › Responses

Accepted. The job was started; href is the job queue URL to poll.

The job that was started. `href` is the job queue resource (/job_queue/{job-queue-id}) to poll for its progress.
href
​string
​object
​Meta

Get the result of an events batch job

GET
https://example.lianacms.com/api/v3
/batch/events/{job-queue-id}

Returns the outcome of a batch job started with POST or PATCH /batch/events, always with status 200.

  • When the job has completed, items lists the rejected elements as they were given (the fields password, unhashed_password, ssn and iban are replaced with [REDACTED]) and errors says why each was rejected, in the same order. Both are empty arrays when every element was written.
  • When the whole job failed, status is given instead, with state failed, the reason in message and the per-element errors.
  • A job with a status but not yet completed gives status with state processing. Batch jobs write their status only when they finish, so a running job is not found yet (404).
  • An id that is not 1 to 64 letters, digits, _ or - returns 400. An unknown job, one whose status is older than 24 hours, or a job of another batch resource returns 404.
  • Requires the Calendar module to be enabled and accessible to the user, otherwise 403. No other permission is checked, and the job does not have to be the user's own.

Get the result of an events batch job › path Parameters

job-queue-id
​string · pattern: ^[A-Za-z0-9_-]{1,64}… · required

Id of the job, as given in the href of the POST or PATCH response: 1 to 64 letters, digits, _ or -. Any other id returns 400.

Get the result of an events batch job › Responses

OK

href
​string
​object[]

Why each rejected element was rejected, in the same order as items.

Present instead of items while the job is processing (state 'processing', without errors) or when the whole job failed (state 'failed', with message and errors). Both are returned with HTTP 200.

​Meta