openapi: 3.2.0 info: title: Harbor Label API description: These APIs provide services for manipulating Harbor project. version: '2.0' servers: - url: http://localhost/api/v2.0 - url: https://localhost/api/v2.0 security: - basic: [] - {} tags: - name: Label paths: /labels: get: summary: List labels according to the query strings description: This endpoint let user list labels by name, scope and project_id tags: - Label operationId: ListLabels parameters: - $ref: '#/components/parameters/requestId' - $ref: '#/components/parameters/query' - $ref: '#/components/parameters/sort' - $ref: '#/components/parameters/page' - $ref: '#/components/parameters/pageSize' - name: name in: query required: false description: The label name. schema: type: string - name: scope in: query required: false description: The label scope. Valid values are g and p. g for global labels and p for project labels. schema: type: string - name: project_id in: query required: false description: Relevant project ID, required when scope is p. schema: type: integer format: int64 responses: '200': description: Get successfully. headers: X-Total-Count: description: The total count of available items schema: type: integer Link: description: Link to previous page and next page schema: type: string content: application/json: schema: type: array items: $ref: '#/components/schemas/Label' '400': $ref: '#/components/responses/400' '401': $ref: '#/components/responses/401' '500': $ref: '#/components/responses/500' post: summary: Post creates a label description: This endpoint let user creates a label. tags: - Label operationId: CreateLabel parameters: - $ref: '#/components/parameters/requestId' responses: '201': description: Create successfully. headers: Location: description: The URL of the created resource schema: type: string '400': $ref: '#/components/responses/400' '401': $ref: '#/components/responses/401' '409': $ref: '#/components/responses/409' '415': $ref: '#/components/responses/415' '500': $ref: '#/components/responses/500' requestBody: content: application/json: schema: $ref: '#/components/schemas/Label' description: The json object of label. required: true /labels/{label_id}: get: summary: Get the label specified by ID description: This endpoint let user get the label by specific ID. tags: - Label operationId: GetLabelByID parameters: - $ref: '#/components/parameters/requestId' - $ref: '#/components/parameters/labelId' responses: '200': description: Get successfully. content: application/json: schema: $ref: '#/components/schemas/Label' '401': $ref: '#/components/responses/401' '404': $ref: '#/components/responses/404' '500': $ref: '#/components/responses/500' put: summary: Update the label properties description: This endpoint let user update label properties. tags: - Label operationId: UpdateLabel parameters: - $ref: '#/components/parameters/requestId' - $ref: '#/components/parameters/labelId' responses: '200': $ref: '#/components/responses/200' '400': $ref: '#/components/responses/400' '401': $ref: '#/components/responses/401' '404': $ref: '#/components/responses/404' '409': $ref: '#/components/responses/409' '500': $ref: '#/components/responses/500' requestBody: content: application/json: schema: $ref: '#/components/schemas/Label' description: The updated label json object. required: true delete: summary: Delete the label specified by ID description: Delete the label specified by ID. tags: - Label operationId: DeleteLabel parameters: - $ref: '#/components/parameters/requestId' - $ref: '#/components/parameters/labelId' responses: '200': $ref: '#/components/responses/200' '400': $ref: '#/components/responses/400' '401': $ref: '#/components/responses/401' '404': $ref: '#/components/responses/404' '500': $ref: '#/components/responses/500' components: responses: '500': description: Internal server error. Inspect the `errors` array in the response body for details. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' '409': description: Conflict. The resource already exists or the current state prevents the operation. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' '415': description: Unsupported media type. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' '401': description: Unauthorized. Authentication is required to access this resource. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' '400': description: Bad request. The request body or query parameters are invalid. Inspect the `errors` array in the response body for details. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' '200': description: Success headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string '404': description: Not found. The requested resource does not exist. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' parameters: sort: name: sort description: Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending order and field2 in descending order with "sort=field1,-field2" in: query required: false schema: type: string pageSize: name: page_size in: query required: false description: The size of per page schema: type: integer format: int64 default: 10 maximum: 100 labelId: name: label_id in: path description: Label ID required: true schema: type: integer format: int64 requestId: name: X-Request-Id description: An unique ID for the request in: header required: false schema: type: string minLength: 1 query: name: q description: Query string to query resources. Supported query patterns are "exact match(k=v)", "fuzzy match(k=~v)", "range(k=[min~max])", "list with union releationship(k={v1 v2 v3})" and "list with intersetion relationship(k=(v1 v2 v3))". The value of range and list can be string(enclosed by " or '), integer or time(in format "2020-04-09 02:36:00"). All of these query patterns should be put in the query string "q=xxx" and splitted by ",". e.g. q=k1=v1,k2=~v2,k3=[min~max] in: query required: false schema: type: string page: name: page in: query required: false description: The page number schema: type: integer format: int64 default: 1 schemas: Label: type: object properties: id: type: integer format: int64 description: The ID of the label name: type: string description: The name the label description: type: string description: The description the label color: type: string description: The color the label scope: type: string description: The scope the label project_id: type: integer format: int64 description: The ID of project that the label belongs to creation_time: type: string format: date-time description: The creation time the label update_time: type: string format: date-time description: The update time of the label Errors: description: The error array that describe the errors got during the handling of request type: object properties: errors: type: array items: $ref: '#/components/schemas/Error' Error: description: a model for all the error response coming from harbor type: object properties: code: type: string description: The error code message: type: string description: The error message example: code: NOT_FOUND message: artifact library/hello-world:latest not found securitySchemes: basic: type: http scheme: basic