Create a Project

To create a project, you make a POST request.

Before creating a project, you get a list of projects to verify that the project you plan to create does not already exist.

Prerequisites

  • Verify that all general prerequisites have been satisfied. See Prerequisites for working with the vRealize Automation Cloud Assembly APIs.
  • Verify that any user who is granted a role within a project has access to the organization through Identity and Access Management.
  • Prepare parameters including the project name, description, and email addresses for administrators, members, or viewers.

Procedure

  1. Get a list of projects.
    curl -X GET -H 'Accept: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/projects?apiVersion=$api_version" | jq "."
  2. To verify that the project you plan to create is not already listed, examine the response.
  3. Assign the project name variable.
    project_name='<your_project_name>'

    your_project_name is a name that you choose.

  4. Create a project.
    curl -X POST \
      "$url/iaas/api/projects?apiVersion=$api_version"
      -H 'Content-Type: application/json' 
      -H "Authorization: Bearer $access_token" 
      -d '{ 
        "name" : "'$project_name'", 
        "description" : "This is an example project", 
        "administrators" : [{ "email" : "<admin_email>", ["type" : <"user" | "group">]}], 
        "members" : [{ "email" : "<member_email>", ["type" : <"user" | "group">]}],
        "viewers" : [{ "email" : "<viewer_email>", ["type" : <"user" | "group">]}], 
      }' | jq "."
    • admin_email, member_email, and viewer_email are email addresses of an administrator, member, and viewer in the project.
    • The type parameter is optional. It assigns the administrator, member, or viewer to a user or group role. If unspecified, the value defaults to user.
  5. Get a list of projects and filter for the project with your_project_name.
    curl -X GET -H 'Accept: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/projects?apiVersion=$api_version&"'$filter'"=name%20eq%20'$project_name'" | jq "."
  6. Examine the response and record the ID of your newly created project.

Example: Create a Project

Create a project named Example-project with administrators, members, and viewers at mycompany.com. This example assumes that Example-project does not already exist.

$ url='https://appliance.domain.com'
$ api_version='2019-01-15'
$ project_name='Example-project'

Create a project with the administrator assigned to a group role.

$ curl -X POST \
  "$url/iaas/api/projects?apiVersion=$api_version" \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $access_token" \
  -d '{ 
    "name" : "'$project_name'", 
    "description" : "This is an example project", 
    "administrators" : [
      {"email" : "[email protected]", "type" : "group"}
    ], 
    "members" : [ 
      {"email" : "[email protected]", "type" : "user"} 
    ], 
    "viewers" : [ 
      {"email" : "[email protected]", "type" : "user"} 
    ] }' | jq "."

A snippet of the response from your request shows the users and groups related to the project and the project ID.

{
  "administrators": [
    {
      "email": "[email protected]",
      "type": "group"
    }
  ],
  "members": [
    {
      "email": "[email protected]",
      "type": "user"
    }
  ],
  "viewers": [
    {
      "email": "[email protected]",
      "type": "user"
    }
  ],
  "zones": [],
  "sharedResources": true,
  "name": "Example-project",
  "description": "This is an example project",
  "id": "5944aacb-91de-4541-bb9e-ef2a5403f81b",
  "organizationId": "8327d53f-91ea-420a-8613-ba8f3149db95",
...

What to do next

Add a cloud zone, plus an additional administrator and user to the project. See Add a Cloud Zone to Your Project.