<commit_before># Retrieve objects
    GET /api/v1/db/<objecttype>/<mask>/<id>?token=<token>[&version=<version>[&schemaversion=<schemaversion>]][&format=<format>]
Object by object ID (`<objecttype>._id` field). One object in the resulting array.

    GET /api/v1/db/<objecttype>/<mask>/global_object_id/<id>?token=<token>[&version=<version>[&schemaversion=<schemaversion>]][&format=<format>]
Object by global object ID (`_global_object_id` field): "local" is a valid alias for the server's instance. One object in the resulting array.

    GET /api/v1/db/<objecttype>/<mask>/system_object_id/<id>?token=<token>[&version=<version>[&schemaversion=<schemaversion>]][&format=<format>]
Object by system object ID (`_system_object_id` field). One object in the resulting array.

    GET /api/v1/db/<objecttype>/<mask>/list?token=<token>[&limit=<limit>][&offset=<offset>][&version=<version>[&schemaversion=<schemaversion>]][&format=<format>]
List of objects, sorted ascending by object IDs (length of array controlled by parameters `limit` and `offset`). Multiple objects in the resulting array.

## Path parameters

|   |   |
|---|---|
| `objecttype` | Object type (string) |
| `mask`       | Mask (string): can be a specific mask name or **\_all\_fields** (see [/api/v1/mask](/technical/api/mask/mask.html)). |
| `id`         | Object ID (integer): get the object with the given **id**. |
| `limit`      | Maximal length of the list of objects (integer): if path specifies **list** instead of a single **id**, return not more than **limit** objects.<br>Default: `100`, Maximum: `1000` |
| `offset`     | Offset in the list of objects (integer): if path specifies **list** instead of a single **id**, return objects from this position in the database |
| `version`    | Object version (integer or **current**, optional): if set, get an archived version of the object(s). Requires an ID.<br>Defaults to the current object version. |
| `schema`     | Schema version (**current**, optional): if set to **current** the object version is rendered in the latest schema version. Defaults to the schema version that was used when the object version was created.<br>Any other value than **current** will cause an error. |
| `format`     | Object format (string): **short**, **standard**, **long** or **full** (default) |

If the given `mask` does not exist in the schema for the given object version, an [Old Mask Missing](/technical/errors/errors.html#old_mask_missing) error is returned.

If no schema for the given object `version` is found, an [Old Schema Missing](/technical/errors/errors.html#old_schema_missing) error is returned.

## Query String

|   |   |
|---|---|
| `token` | Session token acquired with [/api/v1/session](/technical/api/session/session.html) |

## Output

Array of [objects](/technical/types/object/object.html) in the requested format.

## Permissions

The user needs the "read" right for the requested object and the "mask" right for the given mask
(see [rights management](/technical/rightsmanagement/rightsmanagement.html)).

In order to use the "\_all\_fields" mask, the user needs any of the following system rights: "system.root", "system.datamodel.development", "system.datamodel.commit".

## HTTP status codes

|   |   |
|---|---|
| 200 | Success |
| 400 | [API error](/technical/errors/errors.html#api_error): something is malformed |
| 400 | [Not Authenticated](/technical/errors/errors.html#not_authenticated): session is not authenticated |
| 400 | [Insufficient Rights](/technical/errors/errors.html#insufficient_rights): no "read" or "mask" right (the error parameters explain which) |
| 400 | [No System Right](/technical/errors/errors.html#no_system_right): no system right for "\_all\_fields" |
| 400 | [Objecttype Not Found](/technical/errors/errors.html#objecttype_not_found): `objecttype` not found |
| 400 | [Mask Not Found](/technical/errors/errors.html#mask_not_found): `mask` not found |
| 400 | [Object Not Found](/technical/errors/errors.html#object_not_found): object `id` not found |
| 400 | [Instance Not Found](/technical/errors/errors.html#instance_not_found): instance not found (for requests with global object ID) |
| 400 | [Old Mask Missing](/technical/errors/errors.html#old_mask_missing): the given `mask` does not exist in the given `schemaversion` |
| 500 | [Server error](/technical/errors/errors.html#server_error): internal server error |





# Create or update objects
    POST/PUT /api/v1/db/<objecttype>?token=<token>[&confirm=<confirm>][&collection=<collection_id>][&priority=<priority>][&format=<format>][&base_fields_only=1][&progress_uuid=<progress_uuid>]

Creates or updates objects for the given `objecttype`.

Objects are stored in the order of appearance. Each object must specify a `_mask` to be used for reading
the object structure (see [Object type](/technical/types/object/object.html)). The **\_all\_fields** mask is accepted under certain conditions (see "Permissions").

With every mask change, a batch is send to the Importer.

New objects must have either the creator or any of the groups they belong to as owner (except for the special case **create in collection**).

**Group edit**: It is possible to edit a group of objects in such a way that all of them are
updated with the same data. In this mode, only one object is given in the input array, but the `_id` field
is an array containing the IDs of the objects to be updated. The `_version` is automatically updated by the server.

**Create in collection**: If the parameter `collection` is provided, only insertions are allowed. The collection parameters
define which objecttype, mask and pool are allowed for the objects (see [collection](/technical/types/collection/collection.html)).
The objects will be created and inserted in the collection. The owner of the object will be the collection owner.

**Base fields only**: This is a special case in which no mask is provided. Only updates for pool and tags are allowed.

Notice: POST for masks with mask filters is not allowed.

## Path parameters

|   |   |
|---|---|
| `objecttype` | Object type (string) |

## Query String

|   |   |
|---|---|
| `token`      | Session token acquired with [/api/v1/session](/technical/api/session/session.html) |
| `confirm`    | Confirmation code (see below "Transitions") |
| `collection` | ID of the collection where the objects should be inserted |
| `collection_rights_policy` | What to do if the operation causes the owner of a collection to lose grantable rights over collection objects (see [rightsmanagement](/technical/rightsmanagement/rightsmanagement.html#collection_rights_policy)) |
| `priority`   | Priority for the indexer (integer): possible values are:
|              | **-1** very low priority, doesn't generate an `OBJECT_INDEX` event |
|              | **0** (default): low priority, typically used by non-interactive clients, such as the migration tool |
|              | **1**: normal priority, used to signal user interaction |
|              | **2**: high priority, used when a specially fast response is expected |
| `format`     | Object format for the result objects (string): **short** (default), **standard**, **long** or **full** |
| `base_fields_only` | If set to "1", use "base fields only" mode |
| `progress_uuid` | If this variable is set, API_PROGRESS events will be generated during the operation, the `progress_uuid` can then be used to match the events to the operation |

## Input

Array of [objects](/technical/types/object/object.html). The following restrictions apply:

- `_id` must be set for POST and must be not set for PUT. It is an array in the group edit mode.
- `_version` must be 1 (PUT) or the current version plus one (POST).
- `<object-type.name>._pool.pool.id` can be set, but other properties of `<object-type.name>._pool.pool` are read-only.
- the rules for user-defined attributes depend on the object type and the `_mask`.
- other attributes are read-only.
- an object cannot be linked to the root pool, either on creation or update

### Creation or regular update

The object is updated as a whole. That means that if the user only wants to change the value of a certain field,<commit_msg>Link JSON Import to /api/db article with hint to the lookup feature.<commit_after># Retrieve objects
    GET /api/v1/db/<objecttype>/<mask>/<id>?token=<token>[&version=<version>[&schemaversion=<schemaversion>]][&format=<format>]
Object by object ID (`<objecttype>._id` field). One object in the resulting array.

    GET /api/v1/db/<objecttype>/<mask>/global_object_id/<id>?token=<token>[&version=<version>[&schemaversion=<schemaversion>]][&format=<format>]
Object by global object ID (`_global_object_id` field): "local" is a valid alias for the server's instance. One object in the resulting array.

    GET /api/v1/db/<objecttype>/<mask>/system_object_id/<id>?token=<token>[&version=<version>[&schemaversion=<schemaversion>]][&format=<format>]
Object by system object ID (`_system_object_id` field). One object in the resulting array.

    GET /api/v1/db/<objecttype>/<mask>/list?token=<token>[&limit=<limit>][&offset=<offset>][&version=<version>[&schemaversion=<schemaversion>]][&format=<format>]
List of objects, sorted ascending by object IDs (length of array controlled by parameters `limit` and `offset`). Multiple objects in the resulting array.

## Path parameters

|   |   |
|---|---|
| `objecttype` | Object type (string) |
| `mask`       | Mask (string): can be a specific mask name or **\_all\_fields** (see [/api/v1/mask](/technical/api/mask/mask.html)). |
| `id`         | Object ID (integer): get the object with the given **id**. |
| `limit`      | Maximal length of the list of objects (integer): if path specifies **list** instead of a single **id**, return not more than **limit** objects.<br>Default: `100`, Maximum: `1000` |
| `offset`     | Offset in the list of objects (integer): if path specifies **list** instead of a single **id**, return objects from this position in the database |
| `version`    | Object version (integer or **current**, optional): if set, get an archived version of the object(s). Requires an ID.<br>Defaults to the current object version. |
| `schema`     | Schema version (**current**, optional): if set to **current** the object version is rendered in the latest schema version. Defaults to the schema version that was used when the object version was created.<br>Any other value than **current** will cause an error. |
| `format`     | Object format (string): **short**, **standard**, **long** or **full** (default) |

If the given `mask` does not exist in the schema for the given object version, an [Old Mask Missing](/technical/errors/errors.html#old_mask_missing) error is returned.

If no schema for the given object `version` is found, an [Old Schema Missing](/technical/errors/errors.html#old_schema_missing) error is returned.

## Query String

|   |   |
|---|---|
| `token` | Session token acquired with [/api/v1/session](/technical/api/session/session.html) |

## Output

Array of [objects](/technical/types/object/object.html) in the requested format.

## Permissions

The user needs the "read" right for the requested object and the "mask" right for the given mask
(see [rights management](/technical/rightsmanagement/rightsmanagement.html)).

In order to use the "\_all\_fields" mask, the user needs any of the following system rights: "system.root", "system.datamodel.development", "system.datamodel.commit".

## HTTP status codes

|   |   |
|---|---|
| 200 | Success |
| 400 | [API error](/technical/errors/errors.html#api_error): something is malformed |
| 400 | [Not Authenticated](/technical/errors/errors.html#not_authenticated): session is not authenticated |
| 400 | [Insufficient Rights](/technical/errors/errors.html#insufficient_rights): no "read" or "mask" right (the error parameters explain which) |
| 400 | [No System Right](/technical/errors/errors.html#no_system_right): no system right for "\_all\_fields" |
| 400 | [Objecttype Not Found](/technical/errors/errors.html#objecttype_not_found): `objecttype` not found |
| 400 | [Mask Not Found](/technical/errors/errors.html#mask_not_found): `mask` not found |
| 400 | [Object Not Found](/technical/errors/errors.html#object_not_found): object `id` not found |
| 400 | [Instance Not Found](/technical/errors/errors.html#instance_not_found): instance not found (for requests with global object ID) |
| 400 | [Old Mask Missing](/technical/errors/errors.html#old_mask_missing): the given `mask` does not exist in the given `schemaversion` |
| 500 | [Server error](/technical/errors/errors.html#server_error): internal server error |


# Create or update objects
    POST/PUT /api/v1/db/<objecttype>?token=<token>[&confirm=<confirm>][&collection=<collection_id>][&priority=<priority>][&format=<format>][&base_fields_only=1][&progress_uuid=<progress_uuid>]

Creates or updates objects for the given `objecttype`.

Objects are stored in the order of appearance. Each object must specify a `_mask` to be used for reading
the object structure (see [Object type](/technical/types/object/object.html)). The **\_all\_fields** mask is accepted under certain conditions (see "Permissions").

With every mask change, a batch is send to the Importer.

New objects must have either the creator or any of the groups they belong to as owner (except for the special case **create in collection**).

**Group edit**: It is possible to edit a group of objects in such a way that all of them are
updated with the same data. In this mode, only one object is given in the input array, but the `_id` field
is an array containing the IDs of the objects to be updated. The `_version` is automatically updated by the server.

**Create in collection**: If the parameter `collection` is provided, only insertions are allowed. The collection parameters
define which objecttype, mask and pool are allowed for the objects (see [collection](/technical/types/collection/collection.html)).
The objects will be created and inserted in the collection. The owner of the object will be the collection owner.

**Base fields only**: This is a special case in which no mask is provided. Only updates for pool and tags are allowed.

Notice: POST for masks with mask filters is not allowed.

## Path parameters

|   |   |
|---|---|
| `objecttype` | Object type (string) |

## Query String

|   |   |
|---|---|
| `token`      | Session token acquired with [/api/v1/session](/technical/api/session/session.html) |
| `confirm`    | Confirmation code (see below "Transitions") |
| `collection` | ID of the collection where the objects should be inserted |
| `collection_rights_policy` | What to do if the operation causes the owner of a collection to lose grantable rights over collection objects (see [rightsmanagement](/technical/rightsmanagement/rightsmanagement.html#collection_rights_policy)) |
| `priority`   | Priority for the indexer (integer): possible values are:
|              | **-1** very low priority, doesn't generate an `OBJECT_INDEX` event |
|              | **0** (default): low priority, typically used by non-interactive clients, such as the migration tool |
|              | **1**: normal priority, used to signal user interaction |
|              | **2**: high priority, used when a specially fast response is expected |
| `format`     | Object format for the result objects (string): **short** (default), **standard**, **long** or **full** |
| `base_fields_only` | If set to "1", use "base fields only" mode |
| `progress_uuid` | If this variable is set, API_PROGRESS events will be generated during the operation, the `progress_uuid` can then be used to match the events to the operation |

## Input

Array of [objects](/technical/types/object/object.html). The following restrictions apply:

- `_id` must be set for POST and must be not set for PUT. It is an array in the group edit mode.
- `_version` must be 1 (PUT) or the current version plus one (POST).
- `<object-type.name>._pool.pool.id` can be set, but other properties of `<object-type.name>._pool.pool` are read-only.
- the rules for user-defined attributes depend on the object type and the `_mask`.
- other attributes are read-only.
- an object cannot be linked to the root pool, either on creation or update

> `_id` and `_id_parent` can be set using a lookup feature, which selects the object using a reference column. More information about this feature can be found in the [JSON Import](/webfrontend/datamanagement/lists/jsonimport/jsonimport.html) documentation.

### Creation or regular update

The object is updated as a whole. That means that if the user only wants to change the value of a certain field,
{'fraction_non_alphanumeric': 0.12374662263584509, 'fraction_numerical': 0.006604623236265386, 'mean_word_length': 4.550149950016661, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 88, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2851332', 'n_tokens_mistral': 4813, 'n_tokens_neox': 4576, 'n_words': 1887}