swh.web.api.views.snapshot module#

swh.web.api.views.snapshot.api_snapshot(request: Request, snapshot_id: str)[source]#
GET /api/1/snapshot/(snapshot_id)/#

Get information about a snapshot in the archive.

A snapshot is a set of named branches, which are pointers to objects at any level of the Software Heritage DAG. It represents a full picture of an origin at a given time.

As well as pointing to other objects in the Software Heritage DAG, branches can also be aliases, in which case their target is the name of another branch in the same snapshot, or dangling, in which case the target is unknown.

A snapshot identifier is a salted sha1. See swh.model.git_objects.snapshot_git_object() in our data model module for details about how they are computed.

Parameters:
  • snapshot_id (sha1) – a snapshot identifier

Query Parameters:
  • branches_from (str) – optional parameter used to skip branches whose name is lesser than it before returning them

  • branches_count (int) – optional parameter used to restrain the amount of returned branches (default to 1000)

  • target_types (str) – optional comma separated list parameter used to filter the target types of branch to return (possible values that can be contained in that list are content, directory, revision, release, snapshot or alias)

Request Headers:
  • Accept – the requested response content type, either application/json (default) or application/yaml

Response Headers:
  • Content-Type – this depends on Accept header of request

  • Link – indicates that a subsequent result page is available and contains the url pointing to it

Response JSON Object:
  • branches (object) – object containing all branches associated to the snapshot,for each of them the associated target type and id are given but also a link to get information about that target

  • id (string) – the unique identifier of the snapshot

Status Codes:

Example:

https://archive.softwareheritage.org/api/1/snapshot/6a3a2cf0b2b90ce7ae1cf0a221ed68035b686f5a/