As a service administrator, you can use a PATCH request to add, modify, or remove a project user.
Prerequisites
- Verify that all general prerequisites and prerequisites for the Project service have been satisfied. See Prerequisites for API Use Case Examples.
- 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 VMware Aria Automation.
- Prepare parameters including additional email addresses for administrators, members, or viewers that you want to add to the project.
Procedure
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 }