Posted Feb 26 by Peng Qiu.
Updated Feb 26.

This tutorial shows a series of JSON message samples to do copy, move, link and unlink operations in Documentum REST Services.

Last activity Feb 26 by Peng Qiu.
66 views. 0 comments.

Copy a sysobject to a target location

Assumed that you have gotten the resources for a document (“Doc-1.pdf”, with oid 0900000280002924) and a target folder (“Job Description”, with oid 0b00000280002935).

enter image description here

On the folder resource, there is a link relation http://identifiers.emc.com/linkrel/objects pointing to the folder child sysobjects feed.

{
    "name": "folder",
    "type": "dm_folder",
    "definition": "http://localhost:8080/dctm-rest/repositories/REPO1/types/dm_folder",
    "properties": {
        "object_name": "Job Description",
        ...
    },
    "links": [
        ...
        {
            "rel": "http://identifiers.emc.com/linkrel/objects",
            "href": "http://localhost:8080/dctm-rest/repositories/REPO1/folders/0b00000280002935/objects"
        },
        ...
    ]
}

A copy operation needs to POST the source object URI to this feed.

POST /dctm-rest/repositories/REPO1/folders/0b00000280002935/objects HTTP/1.1
Host: localhost:8080
Content-Type: application/json

{
  "href": "http://localhost:8080/dctm-rest/repositories/REPO1/documents/0900000280002924",
  "deep-copy": true
}

From the response, the new object resource is returned. And the URI for the new resource can also be found in the Location header.

HTTP 201 Created
Location: http://localhost:8080/dctm-rest/repositories/REPO1/objects/090000028000294c
Content-Type: application/vnd.emc.documentum+json;charset=UTF-8

Move a sysobject to a target location

Assumed that you have gotten the resources for a document (“Java-Architect.atd”, with oid 0900000280002942) and a target folder (“Tutorials”, with oid 0b00000280002934).

enter image description here

On the sysobject resource, there is a link relation http://identifiers.emc.com/linkrel/parent-links pointing to the parent folder links feed.

{
    "name": "document",
    "type": "dm_document",
    "definition": "http://localhost:8080/dctm-rest/repositories/REPO1/types/dm_document",
    "properties": {
        "object_name": "Java-Architect.atd",
        ...
        "r_object_id": "0900000280002942"
    },
    "links": [
        ...
        {
            "rel": "http://identifiers.emc.com/linkrel/parent-links",
            "href": "http://localhost:8080/dctm-rest/repositories/REPO1/objects/0900000280002942/parent-links"
        },
        ...
    ]
}

Get the parent links feed and find the corresponding entry of the folder link for the source folder location.

GET /dctm-rest/repositories/REPO1/objects/0900000280002942/parent-links HTTP/1.1
Host: localhost:8080
Content-Type: application/json

{
    "id": "http://localhost:8080/dctm-rest/repositories/REPO1/objects/0900000280002942/parent-links",
    "title": "Parent folder links of object 0900000280002942",
    ...
    "entries": [
        {
            "id": "http://localhost:8080/dctm-rest/repositories/REPO1/objects/0900000280002942/parent-links/0b00000280002935",
            "title": "Folder link between child 0900000280002942 and parent 0b00000280002935",
            "summary": "0b00000280002935",
            "updated": "2019-02-13T03:37:00.869+00:00",
            "published": "2019-02-13T03:37:00.869+00:00",
            "links": [
                {
                    "rel": "edit",
                    "href": "http://localhost:8080/dctm-rest/repositories/REPO1/objects/0900000280002942/parent-links/0b00000280002935"
                }
            ],
            ...
        }
    ]
}

A move operation needs to PUT the target folder URI to this link resource.

PUT /dctm-rest/repositories/REPO1/objects/0900000280002942/parent-links/0b00000280002935 HTTP/1.1
Host: localhost:8080
Content-Type: application/json

{
  "href": "http://localhost:8080/dctm-rest/repositories/REPO1/folders/0b00000280002934"
}

The response returns the new link resource for the sysobject and its new location folder.

HTTP 200 OK
Content-Type: application/vnd.emc.documentum+json;charset=UTF-8

{
    "href": "http://localhost:8080/dctm-rest/repositories/REPO1/folders/0b00000280002934",
    "child-id": "0900000280002942",
    "parent-id": "0b00000280002934",
    "links": [
        {
            "rel": "self",
            "href": "http://localhost:8080/dctm-rest/repositories/REPO1/objects/0900000280002942/parent-links/0b00000280002934"
        }
    ]
}

Link a sysobject to a new location

Assumed that you have got the resources for a document (“Financial-Analyst.atd”, with oid 0900000280002928) and a target folder (“Tutorials” with oid 0b00000280002934).

enter image description here

The link operation can be done in two ways: create a new link on the sysobject's parent links feed or create a new link on the target folder's child links feed. In this sample, we show the workflow in the former way.

As we know, the sysobject resource has a link relation http://identifiers.emc.com/linkrel/parent-links pointing to its parent links. A link operation needs to POST the target folder URI to this feed resource.

POST /dctm-rest/repositories/REPO1/objects/0900000280002928/parent-links HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Accept: application/json

{
  "href": "http://localhost:8080/dctm-rest/repositories/REPO1/folders/0b00000280002934"
}

The response returns the new link resource for the sysobject and its new location folder.

HTTP 201 Created
Content-Type: application/json;charset=UTF-8

{
    "href": "http://localhost:8080/dctm-rest/repositories/REPO1/folders/0b00000280002934",
    "child-id": "0900000280002928",
    "parent-id": "0b00000280002934",
    "links": [
        {
            "rel": "self",
            "href": "http://localhost:8080/dctm-rest/repositories/REPO1/objects/0900000280002928/parent-links/0b00000280002934"
        }
    ]
}

After performing the link operation, the document Financial-Analyst.atd can be seen in folder Tutorials.

enter image description here

Unlink a sysobject from a source folder

The unlink operation needs to make a DELETE request to a specified link resource.

enter image description here

DELETE /dctm-rest/repositories/REPO1/objects/0900000280002928/parent-links/0b00000280002935 HTTP/1.1
Host: localhost:8080

After the unlink operation, the document Financial-Analyst.atd doesn't exist in folder Job Description any more.

enter image description here

Please note that Documentum sysobjects can not be parentless (orphan), so DELETE on the only parent link will get a permission denied error as below.

HTTP 403 Forbidden

{
    "status": 403,
    "code": "E_PARENTLESS_NOT_ALLOWED",
    "message": "The operation failed because it is not allowed to make the object parentless.",
    "details": "(DM_SYSOBJECT_E_CANT_SAVE_NO_LINK) Cannot save Financial-Analyst.atd sysobject without any link.",
    "id": "80114d7c-0e31-4f42-ac75-75691dc3ea7e"
}

Table of Contents

Your comment

To leave a comment, please sign in.