As a Cloud Assembly user with the project administrator role, you can use PATCH requests to add users and assign roles in your project.
Prerequisites
- Verify that all general prerequisites have been satisfied. See Prerequisites for working with the Cloud Assembly APIs.
- Verify that you have the project administrator role in your project and you have the project ID. See Create a Project to use in Cloud Assembly.
- 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 Cloud Assembly Project
For the project Example-CA-project, add another administrator and member at mycompany.com.
$ url='https://appliance.domain.com'
$ api_version='2021-07-15'
$ project_id='5944aacb-91de-4541-bb9e-ef2a5403f81b'
List the details of your project.
$ curl -X GET -H 'Accept: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/projects/$project_id?apiVersion=$api_version" | jq "."
A snippet of the response shows existing administrators, members, and viewers.
... "administrators": [ { "email": "[email protected]", "type": "user" } ], "members": [ { "email": "[email protected]", "type": "user" } ], "viewers": [ { "email": "[email protected]", "type": "user" } ], ...
Add the administrator. Include the existing administrator [email protected] in the PATCH request.
$ curl -X PATCH \ "$url/iaas/api/projects/$project_id?apiVersion=$api_version" \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "administrators" : [ {"email" : "[email protected]", "type" : "user"}, {"email" : "[email protected]", "type" : "user"} ] }' | jq "."
Add the member. Include the existing member [email protected] in the PATCH request.
$ curl -X PATCH \ "$url/iaas/api/projects/$project_id?apiVersion=$api_version" \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "members" : [ {"email" : "[email protected]", "type" : "user"}, {"email" : "[email protected]", "type" : "user"} ] }' | jq "."
The response shows the project with administrators, members, and viewers, including the new administrator and new member.
{ "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" } ], "sharedResources": true, "name": "Example-CA-project", "description": "This is an example project for Cloud Assembly", "id": "5944aacb-91de-4541-bb9e-ef2a5403f81b", "orgId": "8327d53f-91ea-420a-8613-ba8f3149db95" } }