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/5717ef211e7c694471d41cd8626d46bbaf647c66/

Response

Body
[
    {
        "checksums": {
            "sha1": "2860029edb623a561f1b9161e02eb61f225b74a8",
            "sha1_git": "94697f956718943973696c09febbb312b83c7fcb",
            "sha256": "e0a6583fb0d03c9a68e8706b6bf95ab457102956ac4038cdbb526b76e5653d95"
        },
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": 6402,
        "name": "Makefile",
        "perms": 33188,
        "status": "visible",
        "target": "94697f956718943973696c09febbb312b83c7fcb",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:94697f956718943973696c09febbb312b83c7fcb/",
        "type": "file"
    },
    {
        "checksums": {
            "sha1": "2bd726abccdee859787f1048e89855ef0db0a276",
            "sha1_git": "dcd3d6e80ff3c48d9da289679ac50872c7bcb4bc",
            "sha256": "3f16f76777af272e939b77878f85df4b7bd0edcc90b8e3c48dcb8b866001b511"
        },
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": 3996,
        "name": "README.rst",
        "perms": 33188,
        "status": "visible",
        "target": "dcd3d6e80ff3c48d9da289679ac50872c7bcb4bc",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:dcd3d6e80ff3c48d9da289679ac50872c7bcb4bc/",
        "type": "file"
    },
    {
        "checksums": {
            "sha1": "bde5045665824786a63b5b8210dc53737efd3fbd",
            "sha1_git": "3ea311fa629dd2ba1482c351ef5684910816922d",
            "sha256": "4e386ca84660e741365580262b3da0ac58b3358e2a89149606f977eb3842ae71"
        },
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": 1522,
        "name": "about.rst",
        "perms": 33188,
        "status": "visible",
        "target": "3ea311fa629dd2ba1482c351ef5684910816922d",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:3ea311fa629dd2ba1482c351ef5684910816922d/",
        "type": "file"
    },
    {
        "checksums": {
            "sha1": "08d419023bc16d5f474785b82b3d6bdf736c017e",
            "sha1_git": "1b0a5a9a9377cbe79f6ee9adca69d6e4aabd9550",
            "sha256": "78141adb1084ea17e46471251990c3a771915de08bb9c3033de197ac3cff9a73"
        },
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": 4342,
        "name": "bugs.rst",
        "perms": 33188,
        "status": "visible",
        "target": "1b0a5a9a9377cbe79f6ee9adca69d6e4aabd9550",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:1b0a5a9a9377cbe79f6ee9adca69d6e4aabd9550/",
        "type": "file"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "c-api",
        "perms": 16384,
        "target": "79da57bb77957b18654a14eeadcbd94c420f143e",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/79da57bb77957b18654a14eeadcbd94c420f143e/",
        "type": "dir"
    },
    {
        "checksums": {
            "sha1": "3e14214d72d8349166a8af6c90aea2fd762a0123",
            "sha1_git": "c1c2472a19630a0a960af24e85ccab7fd7893598",
            "sha256": "e018b01e16cad143accb96e82f711c1b6b088e03789fc131d9fb80025573b50f"
        },
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": 6260,
        "name": "conf.py",
        "perms": 33188,
        "status": "visible",
        "target": "c1c2472a19630a0a960af24e85ccab7fd7893598",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:c1c2472a19630a0a960af24e85ccab7fd7893598/",
        "type": "file"
    },
    {
        "checksums": {
            "sha1": "1f61b776ae8d7e11fd863b1fb4995401456ea6e9",
            "sha1_git": "8690de77bf3d82b94927322b5241561c3f73d5da",
            "sha256": "36c880549e2595e4164fb27829c89becdb72165eb82ded7a75f93c810f9de11c"
        },
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": 538,
        "name": "contents.rst",
        "perms": 33188,
        "status": "visible",
        "target": "8690de77bf3d82b94927322b5241561c3f73d5da",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:8690de77bf3d82b94927322b5241561c3f73d5da/",
        "type": "file"
    },
    {
        "checksums": {
            "sha1": "e81ca1e1dbf282150ab4724e978a5ef2ae5aa4d7",
            "sha1_git": "22d7705846ea936e751bb78490f5445cda3aa62d",
            "sha256": "7cf9adfaba8c11afd817ec93ab9ce5c05d552db1deea5005124e903682ac372d"
        },
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": 451,
        "name": "copyright.rst",
        "perms": 33188,
        "status": "visible",
        "target": "22d7705846ea936e751bb78490f5445cda3aa62d",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:22d7705846ea936e751bb78490f5445cda3aa62d/",
        "type": "file"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "data",
        "perms": 16384,
        "target": "722a64d35de90e6d11c82195ccfc0782e0280d5f",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/722a64d35de90e6d11c82195ccfc0782e0280d5f/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "distributing",
        "perms": 16384,
        "target": "25a0e7e1d7536a7fbf56f24e061c9f9d67d1b25d",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/25a0e7e1d7536a7fbf56f24e061c9f9d67d1b25d/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "distutils",
        "perms": 16384,
        "target": "459130fe570f30ac91762fa50376ba27c459192c",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/459130fe570f30ac91762fa50376ba27c459192c/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "extending",
        "perms": 16384,
        "target": "4a7d1c950c5d186ef9773a5e893f073bb6e28ba6",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/4a7d1c950c5d186ef9773a5e893f073bb6e28ba6/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "faq",
        "perms": 16384,
        "target": "c46f0a53bc2e50cfcb2262f3ed5fc4e4eaa98a27",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/c46f0a53bc2e50cfcb2262f3ed5fc4e4eaa98a27/",
        "type": "dir"
    },
    {
        "checksums": {
            "sha1": "7b847a18d23bb16ff0b8215f7fd57a117a3a0c69",
            "sha1_git": "dba9186d935a6a8bbac3b02ca5abb5867c66a6ab",
            "sha256": "cbfcd862bc53144321808738bbd07e65cb116fd5f7903fa2a876eb55248d9350"
        },
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": 49463,
        "name": "glossary.rst",
        "perms": 33188,
        "status": "visible",
        "target": "dba9186d935a6a8bbac3b02ca5abb5867c66a6ab",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:dba9186d935a6a8bbac3b02ca5abb5867c66a6ab/",
        "type": "file"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "howto",
        "perms": 16384,
        "target": "7ac2e0a5bffdd437af93375cd5780a2017d6f7da",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/7ac2e0a5bffdd437af93375cd5780a2017d6f7da/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "includes",
        "perms": 16384,
        "target": "a811168d355c803479f0277ace50d1dd2790bb83",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/a811168d355c803479f0277ace50d1dd2790bb83/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "install",
        "perms": 16384,
        "target": "0480e9991d4a6f92834d5be87254eddaa3521570",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/0480e9991d4a6f92834d5be87254eddaa3521570/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "installing",
        "perms": 16384,
        "target": "aebd83932e2770969085571795a8970ed9582ff7",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/aebd83932e2770969085571795a8970ed9582ff7/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "library",
        "perms": 16384,
        "target": "fcba0fc901cdfa835be10731965799715446e8f9",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/fcba0fc901cdfa835be10731965799715446e8f9/",
        "type": "dir"
    },
    {
        "checksums": {
            "sha1": "f0ae861fa048c0e60e93456310bab9e9252e472d",
            "sha1_git": "cd018689f875bcbde13737e16bb5737ab5dbd0dc",
            "sha256": "d6e6aab40edd4c0c743b1cb39449b06af8f7a4265981171753b09ba8571042f5"
        },
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": 47263,
        "name": "license.rst",
        "perms": 33188,
        "status": "visible",
        "target": "cd018689f875bcbde13737e16bb5737ab5dbd0dc",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:cd018689f875bcbde13737e16bb5737ab5dbd0dc/",
        "type": "file"
    },
    {
        "checksums": {
            "sha1": "8a04a635a394aeca29ec4f423d533bb2493ed0c5",
            "sha1_git": "b1a3738f309d3b540b4652607f63fec5fa71bbcd",
            "sha256": "f37e297181eaf9d0347755f574d2ae8836e5c9b0998774e3a23db80e592332ba"
        },
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": 4205,
        "name": "make.bat",
        "perms": 33188,
        "status": "visible",
        "target": "b1a3738f309d3b540b4652607f63fec5fa71bbcd",
        "target_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:b1a3738f309d3b540b4652607f63fec5fa71bbcd/",
        "type": "file"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "reference",
        "perms": 16384,
        "target": "ad2c2f10b0fb49e761f9f4e71c4842b0310959cd",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/ad2c2f10b0fb49e761f9f4e71c4842b0310959cd/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "tools",
        "perms": 16384,
        "target": "829572b3ca98a91182229e19bd178fa63135245f",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/829572b3ca98a91182229e19bd178fa63135245f/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "tutorial",
        "perms": 16384,
        "target": "0a0535de01d3ae30df71e0b883e1d5f2b8690ef0",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/0a0535de01d3ae30df71e0b883e1d5f2b8690ef0/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "using",
        "perms": 16384,
        "target": "4bcc3cb6b8002a6664c877d721309e513350dd8c",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/4bcc3cb6b8002a6664c877d721309e513350dd8c/",
        "type": "dir"
    },
    {
        "dir_id": "5717ef211e7c694471d41cd8626d46bbaf647c66",
        "length": null,
        "name": "whatsnew",
        "perms": 16384,
        "target": "949ae5746c68daa7de2e00a6ea8860a1146fba82",
        "target_url": "https://archive.softwareheritage.org/api/1/directory/949ae5746c68daa7de2e00a6ea8860a1146fba82/",
        "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