Changeset View
Changeset View
Standalone View
Standalone View
swh/web/api/v2/spec/paths/content.yml
- This file was added.
# Copyright (C) 2020 The Software Heritage developers | |||||
# See the AUTHORS file at the top-level directory of this distribution | |||||
# License: GNU Affero General Public License version 3, or any later version | |||||
# See top-level LICENSE file for more information | |||||
/contents: | |||||
get: | |||||
tags: | |||||
- content | |||||
operationId: swh.web.api.v2.views.contents | |||||
description: Returns a list of content objects. | |||||
parameters: | |||||
- $ref: "../parameters.yml#swhids_content" | |||||
responses: | |||||
"200": | |||||
description: No error | |||||
content: | |||||
application/json: | |||||
schema: | |||||
$ref: "../schemas.yml#Contents" | |||||
application/yaml: | |||||
schema: | |||||
$ref: "../schemas.yml#Contents" | |||||
"400": | |||||
description: Bad request. List of SWHID is too large or invalid SWHID syntax. | |||||
content: | |||||
application/json: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
application/yaml: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
"404": | |||||
description: Not found. A content object from provided SWHIDs cannot be found in the archive. | |||||
content: | |||||
application/json: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
application/yaml: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
/content/{swhid_content}: | |||||
get: | |||||
tags: | |||||
- content | |||||
operationId: swh.web.api.v2.views.content | |||||
description: Returns a single content object. | |||||
parameters: | |||||
- $ref: "../parameters.yml#swhid_content" | |||||
responses: | |||||
"200": | |||||
description: No error | |||||
content: | |||||
application/json: | |||||
schema: | |||||
$ref: "../schemas.yml#Content" | |||||
application/yaml: | |||||
schema: | |||||
$ref: "../schemas.yml#Content" | |||||
"400": | |||||
description: Bad request. Invalid SWHID syntax or unsupported SWHID type. | |||||
content: | |||||
application/json: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
application/yaml: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
"404": | |||||
description: Not found. No content object with provided SWHID can be found in the archive. | |||||
content: | |||||
application/json: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
application/yaml: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
/content/{swhid_content}/raw: | |||||
get: | |||||
tags: | |||||
- content | |||||
operationId: swh.web.api.v2.views.content_raw | |||||
description: Returns the raw bytes of a Content object. | |||||
parameters: | |||||
- $ref: "../parameters.yml#swhid_content" | |||||
responses: | |||||
"200": | |||||
description: raw content bytes | |||||
content: | |||||
application/octet-stream: | |||||
schema: | |||||
type: string | |||||
format: binary | |||||
"400": | |||||
description: Bad request. Invalid SWHID syntax or unsupported SWHID type. | |||||
content: | |||||
application/json: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
application/yaml: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
"404": | |||||
description: Not found. No content object with provided SWHID can be found in the archive. | |||||
content: | |||||
application/json: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
application/yaml: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
"500": | |||||
$ref: "../responses.yml#UnexpectedError" | |||||
/content/known: | |||||
post: | |||||
tags: | |||||
- content | |||||
operationId: swh.web.api.v2.views.content_known | |||||
description: Checks if contents can be found in the archive | |||||
requestBody: | |||||
required: true | |||||
content: | |||||
application/json: | |||||
schema: | |||||
$ref: "../schemas.yml#swhids_content" | |||||
responses: | |||||
"200": | |||||
description: No error | |||||
content: | |||||
application/json: | |||||
schema: | |||||
type: array | |||||
items: | |||||
$ref: "../schemas.yml#ContentKnown" | |||||
application/yaml: | |||||
schema: | |||||
type: array | |||||
items: | |||||
$ref: "../schemas.yml#ContentKnown" | |||||
"400": | |||||
description: Bad request. Invalid SWHID syntax or unsupported SWHID type. | |||||
content: | |||||
application/json: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" | |||||
application/yaml: | |||||
schema: | |||||
$ref: "../schemas.yml#Error" |