Updated on 2023-04-04 GMT+08:00

Creating an Image Repository

Scenario

This section describes how to create and delete an image repository using APIs. For details on how to call APIs, see Calling APIs.

Procedure

  1. Create an organization.
    • URI format

      POST /v2/manage/namespaces

      For details, see Creating an Organization.

    • Example request

      POST https://{endpoint}/v2/manage/namespaces

      Body:
      {
          "namespace": "group"
      }
    • Example response
      {}
  2. Query the list of organizations.
    • URI format

      GET /v2/manage/namespaces?filter=namespace::{namespace}

      For details, see Querying the List of Organizations.

    • Example request

      GET https://{endpoint}/v2/manage/namespaces?filter=namespace::group

    • Example response
      {
          "namespaces": [
              {
                  "auth": 7,
                  "creator_name": "test",
                  "id": 7,
                  "name": "group"
              }
          ]
      }
  3. Create an image repository.
    • URI format

      POST /v2/manage/namespaces/{namespace}/repos

      For details, see Creating an Image Repository.

    • Example request

      POST https://{endpoint}/v2/manage/namespaces/{namespace}/repos?repository=test&category=linux&description=test&is_public=false

    • Example response
      {}
  4. Query the brief information on an image repository.
    • URI format

      GET /v2/manage/namespaces/{namespace}/repos/{repository}

      For details, see Querying the Brief Information on an Image Repository.

    • Example request

      GET https://{endpoint}/v2/manage/namespaces/{namespace}/repos/{repository}

    • Example response
      {
          "category": "other",
          "created": "2020-10-30T11:35:02.939134Z",
          "creator_id": "ff4f44473a1d4ab3847906410af2d152",
          "creator_name": "test",
          "description": "",
          "domain_id": "8b1e8153e5c4414fa57c356319b633fb",
          "id": 379367,
          "internal_path": ,
          "is_public": true,
          "name": "test",
          "ns_id": 7,
          "num_download": 3,
          "num_images": 1,
          "path": ,
          "priority": 0,
          "size": 1304902,
          "updated": "2020-10-30T11:47:46.084808Z",
          "url": ""
      }