Description

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.

Request

GET https://archive.softwareheritage.org/api/1/directory/b266746952a70c852d4f760b431c28affc6853e2/

Response

Body
[
    {
        "checksums": {
            "sha1": "52344d7138eef091b41eb917d1eff9a5d8c02405",
            "sha1_git": "83cfee34b45cfb69916c1e21b979d7527f5addea",
            "sha256": "9f7c90123572df5327972126f0b4191fbfa0526b545a5a0d58990364e395d139"
        },
        "dir_id": "b266746952a70c852d4f760b431c28affc6853e2",
        "length": 1585,
        "name": "CONTRIBUTING.rst",
        "perms": 33188,
        "status": "visible",
        "target": "83cfee34b45cfb69916c1e21b979d7527f5addea",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:83cfee34b45cfb69916c1e21b979d7527f5addea/",
        "type": "file"
    },
    {
        "checksums": {
            "sha1": "d567c32562bad2a4e2a14d4036358474f4dd6b44",
            "sha1_git": "45d8ffd80cf16c3ce438d54527ff39e59c01afed",
            "sha256": "ec38d36aedad5f65de663610b1d43c2526017edd2ddfa46e76fd4a6d3da2c434"
        },
        "dir_id": "b266746952a70c852d4f760b431c28affc6853e2",
        "length": 453,
        "name": "appveyor.yml",
        "perms": 33188,
        "status": "visible",
        "target": "45d8ffd80cf16c3ce438d54527ff39e59c01afed",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:45d8ffd80cf16c3ce438d54527ff39e59c01afed/",
        "type": "file"
    }
]

URL Allowed Methods

https://archive.softwareheritage.org/api/1/directory/ (sha1_git) /[ (path) /]

GET, HEAD, OPTIONS

Arguments

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

Content-Type

this depends on Accept header of request


Returns

array

an array of objects containing the following keys:

  • 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 /api/1/content/ or /api/1/directory/ depending on the directory entry type

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


HTTP status codes

200

no error

400

an invalid hash_type or hash has been provided

404

requested directory cannot be found in the archive


Examples

/api/1/directory/977fc4b98c0e85816348cebd3b12026407c368b6/
back to top