swh.deposit.api.collection module¶
-
class
swh.deposit.api.collection.
CollectionAPI
[source]¶ Bases:
swh.deposit.api.common.APIPost
Deposit request class defining api endpoints for sword deposit.
What’s known as ‘Col-IRI’ in the sword specification.
HTTP verbs supported: POST
-
parser_classes
= (<class 'swh.deposit.parsers.SWHMultiPartParser'>, <class 'swh.deposit.parsers.SWHFileUploadZipParser'>, <class 'swh.deposit.parsers.SWHFileUploadTarParser'>, <class 'swh.deposit.parsers.SWHAtomEntryParser'>)¶
-
process_post
(req, headers: swh.deposit.api.common.ParsedRequestHeaders, collection_name: str, deposit: Optional[swh.deposit.models.Deposit] = None) → Tuple[int, str, swh.deposit.api.common.Receipt][source]¶ Create a first deposit as: - archive deposit (1 zip) - multipart (1 zip + 1 atom entry) - atom entry
- Parameters
req (Request) – the request holding the information to parse and inject in db
collection_name (str) – the associated client
- Returns
An http response (HttpResponse) according to the situation.
If everything is ok, a 201 response (created) with a deposit receipt.
- Raises
- archive deposit –
400 (bad request) if the request is not providing an external identifier - 403 (forbidden) if the length of the archive exceeds the max size configured - 412 (precondition failed) if the length or hash provided mismatch the reality of the archive. - 415 (unsupported media type) if a wrong media type is provided
- multipart deposit –
400 (bad request) if the request is not providing an external identifier - 412 (precondition failed) if the potentially md5 hash provided mismatch the reality of the archive - 415 (unsupported media type) if a wrong media type is provided
- Atom entry deposit –
400 (bad request) if the request is not providing an external identifier - 400 (bad request) if the request’s body is empty - 415 (unsupported media type) if a wrong media type is provided
-