REST API capabilities for User creation and other related activities
search cancel

REST API capabilities for User creation and other related activities

book

Article ID: 424643

calendar_today

Updated On:

Products

Clarity PPM On Premise Clarity PPM SaaS

Issue/Introduction

What are the various User related activities that can be accomplished using Clarity's REST APIs?

Resolution

Following are some samples. Please test thoroughly in your own system before deploying in Production.

Get Users in the system

GET http://example.com/ppm/rest/v1/users

Get a specific User

GET http://example.com/ppm/rest/v1/users/5085111

  • 5085111 is the Internal ID of the user

Create User

    API Endpoint:
        POST http://example.com/ppm/rest/v1/users
    Payload:
        {
            "lastName": "Account",
            "firstName": "Demo",
            "userName": "demo_account",
            "resourceName": "demo_account",
            "email": "[email protected]",
            "language": "1"
        }

Add Access to a User Account

    API Endpoint:
        PATCH http://example.com/ppm/rest/v1/users
    Payload:
        {"d":[
                {
                    "userGroups":["5000003"],
                    "_internalId":5085364
                }
            ]
        }

5000003 is the Internal ID of the Group from Clarity

Remove Access of a User Account

   API Endpoint:
        PATCH http://example.com/ppm/rest/v1/users
    Payload:
        {"d":[
                {
                    "userGroups":[],
                    "_internalId":5085364
                }
            ]
        }

Notice that the "userGroups" does not have any values assigned to it

Enable Account

    API Endpoint:
        PATCH http://example.com/ppm/rest/v1/users
    Payload:
        {"d":[
                {
                    "status": "200",
                    "_internalId":5085364
                }
            ]
        }

Notice that the Internal ID of the account has to be passed. An additional REST API call can be made, where an user account is filtered by using the Username. From the output of this call, the Internal ID of the account can be determined.

    GET http://example.com/ppm/rest/v1/users?filter=(userName = 'demo_account')

Disable Account

    API Endpoint:
        PATCH http://example.com/ppm/rest/v1/users
    Payload:
        {"d":[
                {
                    "status": "201",
                    "_internalId":5085364
                }
            ]
        }