Using the Project Service API, you can create a project. You can also modify or delete a project and list all projects in an organization.

Before creating a project, it is a good practice to get a list of projects so that you can verify that the project you plan to create does not exist. Then you create the project with users assigned to project roles.

Prerequisites

  • Verify that all general prerequisites and prerequisites for the Project service have been satisfied. See Prerequisites for API Use Case Examples.
  • 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 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/project-service/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/project-service/api/projects?apiVersion=$api_version" \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{ 
        "name" : "'$project_name'", 
        "description" : "your-description", 
        "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 user or name of the group in the project.
    • The type parameter is optional. It assigns the administrator, member, or viewer to a user or group type. If unspecified, the value defaults to user.

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 exist.

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

Create a project with an administrator, member, and viewer assigned to user type roles.

$ curl -X POST \
  "$url/project-service/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" : "user"}], 
    "members" : [{"email" : "[email protected]", "type" : "user"}], 
    "viewers" : [{"email" : "[email protected]", "type" : "user"}] 
  }' | jq "."

The response shows the administrators, members, and viewers related to the project and the project ID.

{
      "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
    },
...