Help Center> SoftWare Repository for Container> API Reference> API> Obtaining the List of Image Retention Policies

Obtaining the List of Image Retention Policies

Function

Obtain the list of image retention policies.

URI

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

Table 1 describes the parameters.

Table 1 Parameter description

Parameter

Mandatory

Type

Description

namespace

Yes

String

Organization name

repository

Yes

String

Image repository name

Request

NA

Response

Response parameters

Table 2 Response body parameter description

Parameter

Type

Description

algorithm

String

Retention policy matching rule. The value is or.

id

Interger

ID

rules

Array of object

For details, see Table 3.

scope

String

Reserved field

Response example

[
    {
        "algorithm": "or",
        "id": 222,
        "rules": [
            {
                "params": {
                    "days": "30"
                },
                "tag_selectors": [
                    {
                        "kind": "label",
                        "pattern": "v5"
                    },
                    {
                        "kind": "label",
                        "pattern": "1.0.1"
                    },
                    {
                        "kind": "regexp",
                        "pattern": "^123$"
                    }
                ],
                "template": "date_rule"
            }
        ],
        "scope": ""
    }
]

Status Code

Table 3 describes the status codes of this API.

Table 3 Status code

Status Code

Description

200

Operation succeeded.

400

Request error.

401

Authentication failed.

404

The organization does not exist.

500

Failed to complete the request because of an internal service error.