As a Automation Assembler 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 and prerequisites for the Automation Assembler Infrastructure as a Service (IaaS) 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 to use in Automation Assembler.
  • 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/iaas/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 administrator that includes the existing administrator for the project.
    Note: If the call does not include existing administrators for the project, the PATCH request removes those administrators from the project. Specifying the administrator type is optional.
    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" : "<your_new_administrator_email>", "type" : "user"},
          {"email" : "<existing_administrator>", "type" : "user"}
        ]
      }' | jq "."
  5. Submit a request to add a new member that includes the existing users for the project.
    Note: If the call does not include existing members for the project, the PATCH request removes those members from the project. Specifying the member type is optional.
    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" : "<your_new_member_email>", "type" : "user"},
          {"email" : "<existing_member>", "type" : "user"}
        ]
      }' | jq "."

Example: Add Users to Your Automation Assembler Project

For the project Example-Assembler-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-Assembler-project",
  "description": "This is an example project for Automation Assembler",
  "id": "5944aacb-91de-4541-bb9e-ef2a5403f81b",
  "orgId": "8327d53f-91ea-420a-8613-ba8f3149db95"
  }
}