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/a8eb01b6b98ad20fa8f80d5c19c36ad27e36a6f1/

Response

Body
[
    {
        "dir_id": "a8eb01b6b98ad20fa8f80d5c19c36ad27e36a6f1",
        "length": null,
        "name": "BuildScript",
        "perms": 16384,
        "target": "88bb8b491127c3fa141e34d94e20a6c310d921dd",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/88bb8b491127c3fa141e34d94e20a6c310d921dd/",
        "type": "dir"
    },
    {
        "checksums": {
            "sha1": "b5998ed009151810c9b4c4cc696422ab2074e883",
            "sha1_git": "ab1af71dfd823ffa8ef330e97e388a5277ba0aee",
            "sha256": "6961f8565efef14ecb34ee67047ee8939a404cc6471e5c997d07dfab3841532d"
        },
        "dir_id": "a8eb01b6b98ad20fa8f80d5c19c36ad27e36a6f1",
        "length": 1652,
        "name": "Extras.install.py",
        "perms": 33188,
        "status": "visible",
        "target": "ab1af71dfd823ffa8ef330e97e388a5277ba0aee",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:ab1af71dfd823ffa8ef330e97e388a5277ba0aee/",
        "type": "file"
    },
    {
        "dir_id": "a8eb01b6b98ad20fa8f80d5c19c36ad27e36a6f1",
        "length": null,
        "name": "IDLE",
        "perms": 16384,
        "target": "6ff5d63ad78fd855b6bb39c259dc57b27c0b4b6c",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/6ff5d63ad78fd855b6bb39c259dc57b27c0b4b6c/",
        "type": "dir"
    },
    {
        "dir_id": "a8eb01b6b98ad20fa8f80d5c19c36ad27e36a6f1",
        "length": null,
        "name": "Icons",
        "perms": 16384,
        "target": "5f6fe1d34812011e940f9d73ec2f8785330a8c4c",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/5f6fe1d34812011e940f9d73ec2f8785330a8c4c/",
        "type": "dir"
    },
    {
        "checksums": {
            "sha1": "6e4d73194528b1e3dcc0911e9d45dcb83884efa4",
            "sha1_git": "1255b13b42493e501025dd3b623b523ca5646c1e",
            "sha256": "27949ed79218e8d5292c474f8ad54feb8e7339fcc8faf23ac83f9c562ae97c86"
        },
        "dir_id": "a8eb01b6b98ad20fa8f80d5c19c36ad27e36a6f1",
        "length": 8336,
        "name": "Makefile.in",
        "perms": 33188,
        "status": "visible",
        "target": "1255b13b42493e501025dd3b623b523ca5646c1e",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:1255b13b42493e501025dd3b623b523ca5646c1e/",
        "type": "file"
    },
    {
        "dir_id": "a8eb01b6b98ad20fa8f80d5c19c36ad27e36a6f1",
        "length": null,
        "name": "PythonLauncher",
        "perms": 16384,
        "target": "707fa166945b6a4482b71a53bb322687921e3b72",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/707fa166945b6a4482b71a53bb322687921e3b72/",
        "type": "dir"
    },
    {
        "checksums": {
            "sha1": "0363e32e045e9cb58f97745b3744a7a431eeffa9",
            "sha1_git": "07f09fa83665283806647f37a2a2191a41d024e5",
            "sha256": "a0152dedbcebed9ae3f1c8bbe10e6bc6fc4ad285759cd48681867803dc16bd77"
        },
        "dir_id": "a8eb01b6b98ad20fa8f80d5c19c36ad27e36a6f1",
        "length": 16074,
        "name": "README",
        "perms": 33188,
        "status": "visible",
        "target": "07f09fa83665283806647f37a2a2191a41d024e5",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:07f09fa83665283806647f37a2a2191a41d024e5/",
        "type": "file"
    },
    {
        "dir_id": "a8eb01b6b98ad20fa8f80d5c19c36ad27e36a6f1",
        "length": null,
        "name": "Resources",
        "perms": 16384,
        "target": "b5fe2c981113e9327b79fca1015177d37e596cae",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/b5fe2c981113e9327b79fca1015177d37e596cae/",
        "type": "dir"
    },
    {
        "dir_id": "a8eb01b6b98ad20fa8f80d5c19c36ad27e36a6f1",
        "length": null,
        "name": "Tools",
        "perms": 16384,
        "target": "43b95e04a643e773b00575faf064128b1696c68e",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/43b95e04a643e773b00575faf064128b1696c68e/",
        "type": "dir"
    }
]

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