As a service administrator, you can use a PATCH request to add, modify, or remove a project user.

Prerequisites

  • Verify that all general prerequisites have been satisfied. See Managing Your Projects Using the Project APIs.
  • Verify that you have the project administrator role in your project and you have the project ID. See Create a Project with the Project Service API.
  • Verify that the project roles that you plan to assign have sufficient permissions to perform project-related tasks.
    Note: A user with the project administrator or project member role can perform a limited number of project-related tasks. For a complete list of tasks and roles required, see Organization and service user roles in vRealize Automation.
  • Prepare parameters including additional email addresses for administrators, members, or viewers that you want to add to the project.

Procedure

  1. Assign the project ID variable.
    project_id='<your_project_id>'

    your_project_id is the ID of the new project you created.

  2. List the details of your project.
    curl -X GET -H 'Accept: application/json' -H "Authorization: Bearer $access_token" "$url/project-service/api/projects/$project_id?apiVersion=$api_version" | jq "."
  3. Examine the response to see the administrators and users who are already in your project.
  4. Submit a request to add a new project administrator.
    curl -X PATCH \
      "$url/project-service/api/projects/$project_id/principals?apiVersion=$api_version" \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "modify" : [
          {
            "email" : "<your_new_administrator_email>", 
            "role" : "administrator", 
            "type" : "user"
          }
        ]
      }' | jq "."
  5. Submit a request to add a new project member.
    curl -X PATCH \
      "$url/project-service/api/projects/$project_id/principals?apiVersion=$api_version" \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "modify" : [
          {
            "email" : "<your_new_member_email>", 
            "role" : "member", 
            "type" : "user"
          }
        ]
      }' | jq "."

Example: Add Users to Your Project

For the project Example-project, add a user with the administrator role and a user with the member role at mycompany.com.

$ url='https://appliance.domain.com'
$ api_version='2019-01-15'
$ project_id='094a2fab-7715-4844-94f9-71b45452da27'

List the details of your project.

$ curl -X GET -H 'Accept: application/json' -H "Authorization: Bearer $access_token" "$url/project-service/api/projects/$project_id?apiVersion=$api_version" | jq "."

The response shows existing administrators, members, and viewers.

{
      "id": "094a2fab-7715-4844-94f9-71b45452da27",
      "name": "Example-project",
      "description": "This is an example project",
      "orgId": "f670fdfc-66d6-4689-9793-d524e7066d1e",
      "administrators": [
        {
          "email": "[email protected]",
          "type": "user"
        }
      "members": [
        {
          "email": "[email protected]",
          "type": "user"
        },
      ],
      "viewers": [
        {
          "email": "[email protected]",
          "type": "user"
        }
      ]
      "supervisors": [],
      "constraints": {
        "network": {
          "conditions": []
        }
      },
      "properties": {},
      "cost": {
        "cost": 0,
        "costSyncTime": "2019-05-13T12:47:10.624Z",
        "costUnit": "USD"
      },
      "operationTimeout": 0,
      "sharedResources": true
    },
...

Add the administrator.

curl -X PATCH \
  "$url/project-service/api/projects/$project_id/principals?apiVersion=$api_version" \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $access_token" \
  -d '{
    "modify" : [
      {
        "email" : "[email protected]", 
        "role" : "administrator", 
        "type" : "user"
      }
    ]
  }' | jq "."

Add the member.

curl -X PATCH \
  "$url/project-service/api/projects/$project_id/principals?apiVersion=$api_version" \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $access_token" \
  -d '{
    "modify" : [
      {
        "email" : "[email protected]", 
        "role" : "member", 
        "type" : "user"
      }
    ]
  }' | jq "."

The response lists the project including the added administrator and added member.

{
      "id": "094a2fab-7715-4844-94f9-71b45452da27",
      "name": "Example-project",
      "description": "This is an example project",
      "orgId": "f670fdfc-66d6-4689-9793-d524e7066d1e",
      "administrators": [
        {
          "email": "[email protected]",
          "type": "user"
        }
        {
          "email": "[email protected]",
          "type": "user"
        }
      "members": [
        {
          "email": "[email protected]",
          "type": "user"
        }
        {
          "email": "[email protected]",
          "type": "user"
        },
      ],
      "viewers": [
        {
          "email": "[email protected]",
          "type": "user"
        }
      ]
      "supervisors": [],
      "constraints": {
        "network": {
          "conditions": []
        }
      },
      "properties": {},
      "cost": {
        "cost": 0,
        "costSyncTime": "2019-05-13T12:47:10.624Z",
        "costUnit": "USD"
      },
      "operationTimeout": 0,
      "sharedResources": true
    }