actions

Some actions are built into the entities. This still exist separately since the package was first created to mirror the structure of Zenodo’s official REST API. These functions will however soon be moved to methods as a part of the deposition entity.

zenodo_rest.depositions.actions.delete_remote(deposition_id: str, token: Optional[str] = None, base_url: Optional[str] = None) requests.models.Response

Delete a not yet published draft of a deposition

Parameters
  • deposition_id (str) – The id of the depsition to be deleted

  • token (Optional[str]) – Your zenodo token (defaults to the ZENODO_TOKEN envvar)

  • base_url (Optional[str]) – The url to the target zenodo server

Returns

The requests HTTP response

Return type

requests.Response

zenodo_rest.depositions.actions.new_version(deposition_id: str, token: Optional[str] = None, base_url: Optional[str] = None) zenodo_rest.entities.deposition.Deposition

Create a new version draft of a deposition

Only one draft may exist at a time, this may fail when a draft already exists

Parameters
  • deposition_id (str) – The id of the deposition to create a new version of.

  • token (Optional[str]) – Your zenodo token (defaults to the ZENODO_TOKEN envvar)

  • base_url (Optional[str]) – The url to the target zenodo server

Returns

The currently published deposition (now containing a link to the draft)

Return type

Deposition

zenodo_rest.depositions.actions.publish(deposition_id: str, token: Optional[str] = None, base_url: Optional[str] = None) zenodo_rest.entities.deposition.Deposition

Publish a deposition

Parameters
  • deposition_id (str) – The id of the deposition to be published

  • token (Optional[str]) – Your zenodo token (defaults to the ZENODO_TOKEN envvar)

  • base_url (Optional[str]) – The url to the target zenodo server

Returns

The published deposition

Return type

Deposition

zenodo_rest.depositions.actions.search(query: Optional[str] = None, status: Optional[str] = None, sort: Optional[str] = None, page: Optional[str] = None, size: Optional[int] = None, all_versions: Optional[bool] = None, token: Optional[str] = None) list[zenodo_rest.entities.deposition.Deposition]

Search for depositions

Parameters
  • query (Optional[str]) – An elasticsearch formatted query

  • status (Optional[str]) – Filter by publication status; either ‘result’ or ‘published’

  • sort (Optional[str]) – Sort order ‘bestmatch’ or ‘mostrecent’ prefix with - to sort descending.

  • page (Optional[str]) – The page of the search to return

  • size (Optional[str]) – The size limit per page

  • all_versions (Optional[str]) – ‘true’ to show all versions, ‘false’ to hide other versions

  • token – your zenodo token

Returns

The list of depositions found

Return type

list[Deposition]

zenodo_rest.depositions.actions.update_metadata(deposition_id: str, metadata: zenodo_rest.entities.metadata.Metadata, token: Optional[str] = None, base_url: Optional[str] = None) zenodo_rest.entities.deposition.Deposition

Update the metadata of a not yet published deposition

Parameters
  • deposition_id (str) – The id of the deposition to update

  • metadata (Metadata) – The metadata to update the deposition with

  • token (Optional[str]) – Your zenodo token (defaults to the ZENODO_TOKEN envvar)

  • base_url (Optional[str]) – The url to the target zenodo server

Returns

The deposition with updated metadata

Return type

Deposition