Directory#

GET /api/1/directory/(sha1_git)/[(path)/]#

Get information about directory objects. Directories are identified by sha1 checksums, compatible with Git directory identifiers. See swh.model.git_objects.directory_git_object() in our data model module for details about how they are computed.

When given only a directory identifier, this endpoint returns information about the directory itself, returning its content (usually a list of directory entries). When given a directory identifier and a path, this endpoint returns information about the directory entry pointed by the relative path, starting path resolution from the given directory.

Parameters:
  • sha1_git (string) – hexadecimal representation of the directory sha1_git identifier

  • path (string) – optional parameter to get information about the directory entry pointed by that relative path

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

Response Headers:
Response JSON Array of Objects:
  • checksums (object) – object holding the computed checksum values for a directory entry (only for file entries)

  • dir_id (string) – sha1_git identifier of the requested directory

  • length (number) – length of a directory entry in bytes (only for file entries) for getting information about the content MIME type

  • name (string) – the directory entry name

  • perms (number) – permissions for the directory entry

  • target (string) – sha1_git identifier of the directory entry

  • target_url (string) – link to GET /api/1/content/[(hash_type):](hash)/ or GET /api/1/directory/(sha1_git)/[(path)/] depending on the directory entry type

  • type (string) – the type of the directory entry, can be either dir, file or rev

Status Codes:

Example:

https://archive.softwareheritage.org/api/1/directory/977fc4b98c0e85816348cebd3b12026407c368b6/