| Back | Main view
Entity versioning using IMiS/Storage Connector Services REST
Product: | IMiS/StorageConnector Services REST |
Release: | 9.8.2110 |
Date: | 08/29/2022 |
Case:
Entity versioning using IMiS/Storage Connector Services REST
Description:
This example demonstrates operations which creates a new entity version on the IMiS/ARChive Server.
The versioning of entities enables the reading of all entity versions, creating, and checking out and checking in an entity draft.
Creating a new entity version is done by creating a draft that can be modified and by checking out the draft which creates a new entity version.
Versioning is defined by a template, in which specific properties enable versioning and can be modified in drafts.
Each version has a sequence version number, with which we can read, edit, delete and check out drafts from a specific version.
Compatibility: IMiS®/ARChive Server 9.9 or higher.
Requests and responses are in JSON format.
Below is a description of operations for the entity versioning.
1. Check out entity
Operation creates draft.
Request
POST archives/{archiveId}/entities/{entityIdKind}:{id}/check_out.json
The set of entityIdKind values: C, E, I.
Headers:
- Authorization: Bearer <session-token>
Query Parameters:
- version: Entity version (optional).
- reason: The reason to check out draft.
Response
Body:
{
"draft_stub": {
"accessed": "2022-08-29T14:40:44.768Z",
"created": "2022-08-29T14:40:44.768Z",
"modified": "2022-08-29T14:40:44.768Z",
"title": "1",
"id": "XtxFIpYYiz6LXm0tYWywKYsX-5xHFpSlJWz45KX6-ok",
...
}
}
2. Draft object change
Operation changes a draft object and description.
Request
PUT archives/{archiveId}/drafts/{idType}:{id}/objects/{objectId}
The set of IdType values: H, I.
Headers:
- Authorization: Bearer <session-token>
- Content-Type: Draft object type.
Query Parameters:
- description: A description of the content object.
- new_index: New object index in the collection of entity objects (applies to a specific content object container)
- reason: The reason to change draft.
Body:
<content-bytes>
Response
Body:
{
"object": {
"id": "rwyApx_y7XSiaHywDZ77nsxyH9HSPvKwAQl4thajc",
"description": "Textual report",
"size": 4,
"created": "2022-08-15T11:27:04.040+01:00",
"accessed": "2022-08-15T11:27:04.040+01:00",
"modified": "2022-08-15T11:27:04.040+01:00",
"content_type": "text/plain",
"extension": ".txt"
}
}
3. Draft change
Operation changes a draft.
Request
PUT archives/{archiveId}/drafts/{idType}:{id}.json
The set of IdType values: H, I.
Headers:
- Authorization: Bearer <session-token>
Query Parameters:
- flat: Specifies whether the response shows child objects as a flat list (optional; default value: false).
- max_level: Specifies the level of child objects only if tree = true, default value = 0 (show all).
- reason: The reason to change draft.
- tree: Specifies whether the response shows child objects as a tree structure (optional; default value: true).
Body:
{
"draft_update": {
"title": "Company documentation 1.1"
}
}
Response
Body:
{
"draft": {
"accessed": "2019-05-06T07:21:50.097Z",
"created": "2019-04-30T13:14:21.625Z",
"description": "opis dokumenta",
"modified": "2019-05-06T12:12:30.857Z",
"modified_by": {
"id": "admin",
"email": "admin@acme.com",
"first_name": "",
"last_name": "Administrator",
"type": "USER"
},
"title": "Company documentation 1.1",
"id": "7AuIpwC-E9FNjS-HJo6Ew7zjC6gr2ACc",
"properties": [],
"keywords": [],
...
}
}
4. Check in draft
Operation checks in a draft. Changes to the draft will be saved to the entity from which the draft was created.
Request
POST archives/{archiveId}/drafts/{id}/check_in.json
Headers:
- Authorization: Bearer <session-token>
Query Parameters:
- reason: The reason to check in draft.
Body:
{
"check_in": {
"position": 1,
"comment": "Version comment"
}
}
Response
Body:
{
"entity_stub": {
"aip": false,
"categories": [],
"child_count": 0,
"classification_code": "C=5^D=000231",
"created": "2022-07-12T08:32:25.067Z",
...
}
}
5. Discard draft
Operation discards a draft.
Request
POST archives/{archiveId}/drafts/{id}/discard.json
Headers:
- Authorization: Bearer <session-token>
Query Parameters:
- reason: The reason to discard draft.
Response
Operation returns status 200.
6. Read entity versions
Operation reads entity versions.
Request
GET archives/{archiveId}/entities/{entityIdKind}:{id}/versions.json
The set of entityIdKind values: C, E, I, H.
Headers:
- Authorization: Bearer <session-token>
Query Parameters:
- fields: Defines the fields in the reply.
Response
Body:
{
"versions": [
{
"accessed": "2022-08-04T12:33:26.000Z",
"aip": true,
"categories": [],
"check_in_comment": null,
"version": 4,
"version_label": "2.2"
...
},
{
"accessed": "2022-08-04T11:11:39.000Z",
"aip": true,
"categories": [],
"check_in_comment": null,
"version": 3,
"version_label": "2.1"
...
}
]
}
7. Read drafts
Operation reads drafts.
Request
GET archives/{archiveId}/drafts.json
Headers:
- Authorization: Bearer <session-token>
Query Parameters:
- page_start: The beginning of the page.
- page_size: The size of the page.
- refresh: If value is true than entity information is created again; otherwise information is created only first time.
- sort: The sort keys of the collection. The set of values:
- sys:Title: The title of the draft.
- sys:Creator: The creator of the draft.
- sys:Owner: The owner of the draft.
- The unique identifier of the property.
- Example: sys:EntityType,sys:Title.
- sort_order: The sort order of the collection. The set of values:
- asc: Ascending (default value),
- desc: Descending.
- category_properties: The property used to request the categorization of the draft collection.
- category: The category of the entity collection.
- fields: Defines the fields in the reply.
- Example: page_size,page_start,size,categories,handle,entities(id,title,modified,effective_rights,closed,description,type,template)
- handle: Collection handle.
Response
Body:
{
"size": 1,
"page_start": 0,
"page_size": 50,
"handle": "MTMxMDgzOzdhMWI2NjliLTViZDYtNDk2NS04OWFhLTJlZmQ0M2U5ZGYwMg",
"entities": [
{
"description": "Duis auctor ligula arcu, non porta augue feugiat eu.",
"modified": "2022-08-24T12:08:45.796Z",
"title": "Kočna",
"id": "NOmpFZe-Iff9KgHcaTH1TGxNK7ilqtBZWPvot_4Wong",
"effective_rights": {
"create_references": true,
"create_sub_entities": true,
"change_retention": true,
"change_rights": true,
"change_security_class": true,
"change_status": true,
"delete_access": true,
"move_access": true,
"read_access": true,
"write_access": true
},
"template": {
"id": "Document",
"label": "Document",
"entity_type": "DOCUMENT"
},
"type": "DOCUMENT"
}
],
"categories": []
}
Related Documents:
| Back | Main view