Events of the calendar module. They work like news items, with event permissions.
Create events in a batch
- 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
hrefpointing 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_modifypermission or membership in group 1, otherwise 403.
Create events in a batch › Request Body
Title per language; at least one.
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.
Commenting per language; public when not given.
Owner user id per language, as a JSON integer; the current user when not given. The user must exist and not be deleted.
Start of validity per language (ISO 8601).
End of validity per language (ISO 8601); must not be before valid_froms of the same language.
Visibility per language; public when not given.
Create events in a batch › Responses
Accepted. The job was started; href is the job queue URL to poll.
Update events in a batch
- 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
hrefpointing 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
idand is validated as inPATCH /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_modifypermission or membership in group 1, otherwise 403.
Update events in a batch › Request Body
idtranslationTitle.
introbodycommentingownerOwner user id as a JSON string (an integer is refused). The user must exist and not be deleted.
valid_fromvalid_tovisibilitycategoriesThe 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.
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.
Get the result of an events batch job
Returns the outcome of a batch job started with POST or PATCH /batch/events, always with status 200.
- When the job has completed,
itemslists the rejected elements as they were given (the fieldspassword,unhashed_password,ssnandibanare replaced with[REDACTED]) anderrorssays why each was rejected, in the same order. Both are empty arrays when every element was written. - When the whole job failed,
statusis given instead, with statefailed, the reason inmessageand the per-elementerrors. - A job with a status but not yet completed gives
statuswith stateprocessing. 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.
path Parameters
job-queue-id^[A-Za-z0-9_-]{1,64}… · requiredId 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
hrefWhy 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.
List events
Events are stored as news items of the event type: fields, filters and rules are the same as for /news,
with the Calendar module and the event permissions and categories in place of the news ones.
Returns event language versions (previews excluded) that are linked to a category the user can view under
the event root category. The user needs the events_view or events_modify permission unless they are
in the administrators group. Items are ordered by id, highest first, and each has an href.
Array filters must be sent with [] (owner[]=1&owner[]=2); the values of one filter are alternatives,
different filters must all match. properties are included only with show_properties=true.
400 is returned when langcode[] is missing, a filter is not an array where one is expected, or a value is
invalid (unknown visibility or commenting, non-integer owner or category, category the user cannot
administer, invalid date-time). 403 is returned when the Calendar module is not enabled or the user has no
access to it.
query Parameters
langcode[]Required. Return only language versions in the given languages. The codes are matched exactly, so use upper
case. Must be sent as an array (langcode[]=FI&langcode[]=EN); without it the request is refused with 400.
limitThe number of items to return, 0 to 200. A value outside that range returns 400.
offsetThe number of items to skip. A negative value is treated as 0. Use the next and prev links of the response to page through a list.
categories[]Return only items linked to one of the given categories (categories[]=1&categories[]=2). Every id must be
an integer and an event category the user can administer; otherwise 400.
visibility[]Return only items with one of the given visibilities (visibility[]=hidden&visibility[]=public). Other values are refused with 400.
commenting[]Return only items with one of the given commenting settings (commenting[]=none&commenting[]=public). Other values are refused with 400.
owner[]Return only items owned by one of the given user ids (owner[]=1&owner[]=2). A non-integer value is refused with 400.
valid_from_beforeReturn only items whose validity starts before (not at) the given ISO 8601 date-time. An invalid date-time is refused with 400.
valid_from_afterReturn only items whose validity starts after (not at) the given ISO 8601 date-time. An invalid date-time is refused with 400.
valid_to_beforeReturn only items whose validity ends before (not at) the given ISO 8601 date-time. An invalid date-time is refused with 400.
valid_to_afterReturn only items whose validity ends after (not at) the given ISO 8601 date-time. An invalid date-time is refused with 400.
posted_beforeReturn only items posted before (not at) the given ISO 8601 date-time. An invalid date-time is refused with 400.
posted_afterReturn only items posted after (not at) the given ISO 8601 date-time. An invalid date-time is refused with 400.
modified_beforeReturn only items modified before (not at) the given ISO 8601 date-time. An invalid date-time is refused with 400.
modified_afterReturn only items modified after (not at) the given ISO 8601 date-time. An invalid date-time is refused with 400.
valid_fromReturn only items whose validity starts exactly at the given ISO 8601 date-time. An invalid date-time is refused with 400.
valid_toReturn only items whose validity ends exactly at the given ISO 8601 date-time. An invalid date-time is refused with 400.
postedReturn only items posted exactly at the given ISO 8601 date-time. An invalid date-time is refused with 400.
modifiedReturn only items modified exactly at the given ISO 8601 date-time. An invalid date-time is refused with 400.
show_propertiesInclude properties in the items. Only the exact value true turns it on; any other value is the same as leaving it out.
List events › Responses
OK
hrefFirst page.
Previous page; the offset stops at 0.
Next page. On the last page the link wraps around to offset 0.
Create an event
Creates an event with one language version per key of translations and returns the created versions,
each with an href, its properties and its links. The user needs the events_modify permission
(administrators always have it), and the categories permission with the admin right to every category
given.
400 is returned when translations or categories is missing, a map has a key that is not a site language
or not in translations, a value has the wrong type or is empty, commentings or visibilities has another
value than listed, a category is not one the user can administer, a language has no category named in that
language, an owner is not an existing user, valid_froms is later than valid_tos, or a property is
invalid. 403 is returned when the module is not enabled, the user has no access to it, or the user lacks
the events_modify permission.
Create an event › Request Body
Title per language; at least one.
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.
Commenting per language; public when not given.
Owner user id per language, as a JSON integer; the current user when not given. The user must exist and not be deleted.
Start of validity per language (ISO 8601).
End of validity per language (ISO 8601); must not be before valid_froms of the same language.
Visibility per language; public when not given.
Create an event › Responses
OK
Get an event language version
Returns the language version with the given id as the only element of items, always with properties
and without an item href. Query parameters other than limit and offset are ignored.
400 is returned when the id is not an integer. 403 is returned when the Calendar module is not enabled or the user has no access to it. 404 is returned when the item does not exist or the user cannot view it.
path Parameters
event-idId of an event. Any language version's id is accepted.
Get an event language version › Responses
OK
Add a language version to an event
Adds a language version to the item that has the given id as one of its versions, and returns the new
version with its properties and a flat list of links. Rights as for POST /events.
400 is returned when translation, language or categories is missing, the language is not a site
language or the item already has it, commenting or visibility has another value than listed, owner
is not a string naming an existing user, a category has no name in the language, valid_from is later than
valid_to, or a property is invalid. 403 is returned when the module is not enabled, the user has no access
to it, or lacks the events_modify permission. 404 is returned when the item does not exist or the user
cannot view it.
path Parameters
event-idId of an event. Any language version's id is accepted.
Add a language version to an event › Request Body
translationTitle.
languageLanguage of the new version. Must be a site language the item does not have yet.
categoriesCategory ids. Each must be an event category the user can administer that has a name in language.
introbodycommentingownerOwner user id as a JSON string (an integer is refused); the current user when not given.
valid_fromvalid_tovisibilityAdd a language version to an event › Responses
OK
Update an event language version
Changes the given fields of one language version, sets its modification time and returns it with its
properties. The user needs the events_modify permission (administrators always have it); changing
categories also needs the categories permission with the admin right to every category given.
400 is returned when the id is not an integer, the body has no known field, a field has the
wrong type, commenting or visibility has another value than listed, owner is not a string naming an
existing user, a category is not one the user can administer, valid_from is later than valid_to, or a
property is invalid. 403 is returned when the module is not enabled, the user has no access to it, or lacks
the events_modify permission. 404 is returned when the item does not exist or the user cannot view it.
path Parameters
event-idId of an event. Any language version's id is accepted.
Update an event language version › Request Body
translationTitle.
introbodycommentingownerOwner user id as a JSON string (an integer is refused). The user must exist and not be deleted.
valid_fromvalid_tovisibilitycategoriesThe 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.
Property values to replace. null deletes all property values of the item.
Update an event language version › Responses
OK
Delete an event language version
Deletes the language version with the given id, or with remove_all_versions all versions of the item, and
returns the deleted versions. The body is optional, but the request needs a JSON (or text/plain)
Content-Type header even without one. remove_all_versions is read only from the body.
400 is returned when the id is not an integer, or remove_all_versions is not a boolean. 403 is
returned when the module is not enabled, the user has no access to it, or lacks the events_delete
permission (administrators always have it). 404 is returned when the item does not exist or the user
cannot view it.
path Parameters
event-idId of an event. Any language version's id is accepted.
Delete an event language version › Request Body optional
remove_all_versionsDelete all language versions of the item instead of only the one given in the path.
Delete an event language version › Responses
OK