REST API - create

vcenter content registries harbor projects: create

Creates a project in a Harbor registry using the supplied specification. In vSphere 7.0, a Harbor registry is deployed in a vSphere cluster with vSphere namespaces enabled. When a namespace is created, a project with same name as the namespace is created in the Harbor registry, so this operation should not be called.

Request:

HTTP request

POST https://{server}/rest/vcenter/content/registries/harbor/{registry}/projects

Path Parameters

Name Type Description
Required
registry string Identifier of the Registry.

Request Body Structure:

{
    "spec"{
        "scope""PUBLIC",
        "name""string"
    }
}

Request Body Parameters:

Name Type Description
bold = required
spec create_spec Information used to create the Harbor project.
spec.name string Name of the Harbor project. Should be between 1-63 characters long alphanumeric string and may contain the following characters: a-z,0-9, and '-'. Must be starting with characters or numbers, with the '-' character allowed anywhere except the first or last character.

spec.scope string Access type of a Harbor project.

In a project defines access levels of the project. Value is one of:
PUBLIC: A Harbor project can be accessed by everyone.
PRIVATE: A Harbor project can only be accessed by assigned users.

Response:

HTTP Status Code: 200

Representation:

{
    "value""obj-103"
}

Response Type:

Name Type Description
bold = required
value string Identifier of the newly created Harbor project.

Errors:

HTTP Status Code Type Description
400 invalid_argument if spec contains any error.
400 not_allowed_in_current_state if Harbor registry is being deleted.
404 not_found if a registry specified by registry could not be found.
400 already_exists if a project with the same name already exists in the registry. In vSphere 7.0, the existing project could have been created automatically when a namespace with the same name is created.
500 error if the system reports an error while responding to the request.
401 unauthenticated if the user can not be authenticated.
403 unauthorized if the user does not have ContentLibrary.ManageRegistryProject privilege.