Posted Nov 04 by Peng Qiu.
Updated Nov 04.

This article shows a series of JSON message samples to create, retrieve, update, and delete dm_user and dm_group objects in Documentum REST Services.

Last activity Nov 04 by Peng Qiu.
121 views. 0 comments.

Get Users Collection

Assumed that you get a repository with below request.

GET http://localhost:8080/dctm-rest/repositories/repo
Accept: application/json

From the repository resouce, you'll find a link relation http://identifiers.emc.com/linkrel/users which points to Users collection.

{
    "id": 1,
    "name": "repo",
    ...
    "links": [
        ...
        {
            "rel": "http://identifiers.emc.com/linkrel/users",
            "href": "http://localhost:8080/dctm-rest/repositories/repo/users"
        },
        ...
    ]
}

With this link relation, we can make a GET request to get users in this repository.

GET http://localhost:8080/dctm-rest/repositories/repo/users
Accept: application/json

From the response, Users collection is returned. It's a regular feed collection resource that supports inline, pagination, filter, view and other common parameters.

{
    "id": "http://localhost:8080/dctm-rest/repositories/repo/users",
    "title": "Users",
    "author": [
        {
            "name": "Open Text Documentum"
        }
    ],
    "updated": "2018-10-30T07:57:07.706+00:00",
    "page": 1,
    "items-per-page": 100,
    "links": [
        {
            "rel": "self",
            "href": "http://localhost:8080/dctm-rest/repositories/repo/users"
        }
    ],
    "entries": [
        {
            "id": "http://localhost:8080/dctm-rest/repositories/repo/users/Administrator",
            "title": "Administrator",
            "summary": "",
            "updated": "2018-09-18T10:25:34.000+00:00",
            "published": "2018-09-18T10:25:34.000+00:00",
            "links": [
                {
                    "rel": "edit",
                    "href": "http://localhost:8080/dctm-rest/repositories/repo/users/Administrator"
                }
            ],
            "content": {
                "type": "application/vnd.emc.documentum+json",
                "src": "http://localhost:8080/dctm-rest/repositories/repo/users/Administrator"
            }
        },
        ...
    ]
}

For any single user resource, please make a GET request to the href of the link relation edit
on specific feed entries.

GET http://localhost:8080/dctm-rest/repositories/repo/users/Administrator
Accept: application/json

The response returns the user resource.

{
    "name": "user",
    "type": "dm_user",
    "definition": "http://localhost:8080/dctm-rest/repositories/repo/types/dm_user",
    "properties": {
        "user_name": "Administrator",
        "user_os_name": "Administrator",
        ...
    },
    "links": [
        {
            "rel": "self",
            "href": "http://localhost:8080/dctm-rest/repositories/repo/users/Administrator"
        },
        ...
    ]
}

Create a User

In Users collection resource, we can create a user by making a POST request, with the new user request payload. Properties user_name and user_login_name are mandatory.

POST http://localhost:8080/dctm-rest/repositories/repo/users
Content-Type: application/json

{“properties”:{“user_name”: “demo-user”, “user_login_name”: “demologin”,“user_source”: “inline password”,“user_password”:“password”}}

The response returns the link of the newly created user in header Location. The response also returns the new user representation in the response body. Please note user password is NOT returned.

HTTP 201 Created
Location: http://localhost:8080/dctm-rest/repositories/repo/users/demo-user

The user resource representation uses the link relation edit to indicate whether the accessor has the privilege to update it. On the user resource we are going to update, if the accessor sees the link relation edit, it indicates that the accessor has the privilege to update this user.

{
    "name": "user",
    "type": "dm_user",
    "definition": "http://localhost:8080/dctm-rest/repositories/repo/types/dm_user",
    "properties": {
        "user_name": "demo-user",
        ...
        "user_state": 0,
        ...
    },
    "links": [
        ...
        {
            "rel": "edit",
            "href": "http://localhost:8080/dctm-rest/repositories/repo/users/demo-user"
        },
        ...
    ]
}

Please update this user by POST user properties we are going to change. For example, update the user state to locked.

POST http://localhost:8080/dctm-rest/repositories/repo/users/demo-user
Content-Type: application/json

{“properties”:{“user_state”: 1}}

The response returns 200 if the update is successful, and the updated user representation is returned in response body.

{
    "name": "user",
    "type": "dm_user",
    "definition": "http://localhost:8080/dctm-rest/repositories/repo/types/dm_user",
    "properties": {
        "user_name": "demo-user",
        ...
        "user_state": 1,
        ...
    },
    "links": [
        ...
    ]
}

Delete a User

The user representation uses the link relation delete to indicate whether the accessor has the permission to delete it. On the user resource we have obtained, if the accessor sees the link relation , it indicates that the accessor has the permission to delete this user.

DELETE http://localhost:8080/dctm-rest/repositories/repo/users/demo-user
Accept: application/json

The response returns status code 204 without a response body if the deletion is successful.

Manage Groups

The CRUD of groups are similar to users CRUD. On a repository resource, we can find the
link relation http://identifiers.emc.com/linkrel/groups which points to the Groups collection resource.

Besides the CRUD, we can also mange the members of a group. For more details about the group members management, please check Tutorial : Manage Group Members in Documentum REST Services


Table of Contents

Your comment

To leave a comment, please sign in.