Advanced
Тема интерфейса

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.

Involved APIs

In this example, the following APIs are used:

Endpoints

An endpoint is the request address for calling an API. Endpoints vary depending on services and regions. For the endpoints of all services, see Regions and Endpoints.

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}

    • 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

    • 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}

    • 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": "swr.ru-moscow-1.hc.sbercloud.ru/group/test",
      "is_public": true,
      "name": "test",
      "ns_id": 7,
      "num_download": 3,
      "num_images": 1,
      "path": "swr.ru-moscow-1.hc.sbercloud.ru/group/test",
      "priority": 0,
      "size": 1304902,
      "updated": "2020-10-30T11:47:46.084808Z",
      "url": ""
      }