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/01cd5744570f4be57d9ece0e62b324ef5d0d29fb/

Response

Body
[
    {
        "checksums": {
            "sha1": "a0a1f5d5553d92310ec51d20e13fabb92d5523b4",
            "sha1_git": "35528811fee9fd9a58da9c9fb5926a1011bc8cad",
            "sha256": "8a582896bcee4ef2bb3a1369dbf00db9b99949ad18ade3bbca39e5942c4a7fce"
        },
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": 1826,
        "name": "README",
        "perms": 33188,
        "status": "visible",
        "target": "35528811fee9fd9a58da9c9fb5926a1011bc8cad",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:35528811fee9fd9a58da9c9fb5926a1011bc8cad/",
        "type": "file"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "buildbot",
        "perms": 16384,
        "target": "71e266151b7ad10cfb1bd704d6a7b9b32d1274a7",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/71e266151b7ad10cfb1bd704d6a7b9b32d1274a7/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "ccbench",
        "perms": 16384,
        "target": "b1b44911876d3b8e898090cf737a0a9a43797e2a",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/b1b44911876d3b8e898090cf737a0a9a43797e2a/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "clinic",
        "perms": 16384,
        "target": "beea175e0c3f9f6b9683ddfcad71b41a6348c408",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/beea175e0c3f9f6b9683ddfcad71b41a6348c408/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "demo",
        "perms": 16384,
        "target": "8d354e3e3dd762d1dbcf428605496a553e70d9d1",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/8d354e3e3dd762d1dbcf428605496a553e70d9d1/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "freeze",
        "perms": 16384,
        "target": "31a2c87179b5d0c002eee3d687fad202b16b981b",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/31a2c87179b5d0c002eee3d687fad202b16b981b/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "gdb",
        "perms": 16384,
        "target": "784c4e4938d360b169b14d18eb341f698839115d",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/784c4e4938d360b169b14d18eb341f698839115d/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "i18n",
        "perms": 16384,
        "target": "d27fc8d8e26aed1a519be4842c9e6a6447ab8942",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/d27fc8d8e26aed1a519be4842c9e6a6447ab8942/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "importbench",
        "perms": 16384,
        "target": "e624d187ba6c7e731c29417f7ffb59ecc86d77f5",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/e624d187ba6c7e731c29417f7ffb59ecc86d77f5/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "iobench",
        "perms": 16384,
        "target": "8c6f88f95a67c47c8abb968a7a7c0fcb2b09df32",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/8c6f88f95a67c47c8abb968a7a7c0fcb2b09df32/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "msi",
        "perms": 16384,
        "target": "342e1dbb5bd486c9ea91d9c94f55973deaf33b75",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/342e1dbb5bd486c9ea91d9c94f55973deaf33b75/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "nuget",
        "perms": 16384,
        "target": "d6b4be091cb05f9019bf625320a1788c96d32b1a",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/d6b4be091cb05f9019bf625320a1788c96d32b1a/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "parser",
        "perms": 16384,
        "target": "d48df51068f35ebe5d2a191f51452ad03d6bda1d",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/d48df51068f35ebe5d2a191f51452ad03d6bda1d/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "pynche",
        "perms": 16384,
        "target": "e2de01ade4f29194611608ad275d3fa2f5f7da32",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/e2de01ade4f29194611608ad275d3fa2f5f7da32/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "scripts",
        "perms": 16384,
        "target": "ad56e92662fd6a1f680e5f97b8d6392c2b747376",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/ad56e92662fd6a1f680e5f97b8d6392c2b747376/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "ssl",
        "perms": 16384,
        "target": "2f83fbe17e27cf5af29b87225e566c9a0467b9f7",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/2f83fbe17e27cf5af29b87225e566c9a0467b9f7/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "stringbench",
        "perms": 16384,
        "target": "711e1d4b73957d1626363dce719a62019581c5f3",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/711e1d4b73957d1626363dce719a62019581c5f3/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "test2to3",
        "perms": 16384,
        "target": "651d6046785063181e6d20e1599fc8abf14d8079",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/651d6046785063181e6d20e1599fc8abf14d8079/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "tz",
        "perms": 16384,
        "target": "48621b67535da8c2ae22916f5101fd9283e590c3",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/48621b67535da8c2ae22916f5101fd9283e590c3/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "unicode",
        "perms": 16384,
        "target": "0971753ef764a10271b475e20e62a84d08a033e9",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/0971753ef764a10271b475e20e62a84d08a033e9/",
        "type": "dir"
    },
    {
        "dir_id": "01cd5744570f4be57d9ece0e62b324ef5d0d29fb",
        "length": null,
        "name": "unittestgui",
        "perms": 16384,
        "target": "a5180313cdd72d0b1686cd9ed702bf3030a31bd1",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/a5180313cdd72d0b1686cd9ed702bf3030a31bd1/",
        "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