Description

Get information about a content (aka a "blob") object. In the archive, a content object is identified based on checksum values computed using various hashing algorithms.

Request

GET https://archive.softwareheritage.org/api/1/content/sha1_git:2a745e57466cae1af014f239e5b91a8fc1fd64d8/

Response

Body
{
    "checksums": {
        "blake2s256": "f1f136850bfb86b721ae83dddede18c286bc4864ee8577b66cfe7719f5e226b5",
        "sha1": "a9fb2499c15f934a064bf3e9a59ce0516db01676",
        "sha1_git": "2a745e57466cae1af014f239e5b91a8fc1fd64d8",
        "sha256": "b062dd22e0803d82b381149d4ce30e58c7a2d2037a03e062c3e51160f1334fd8"
    },
    "data_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:2a745e57466cae1af014f239e5b91a8fc1fd64d8/raw/",
    "filetype_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:2a745e57466cae1af014f239e5b91a8fc1fd64d8/filetype/",
    "language_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:2a745e57466cae1af014f239e5b91a8fc1fd64d8/language/",
    "length": 10914,
    "license_url": "https://archive.softwareheritage.org/api/1/content/sha1_git:2a745e57466cae1af014f239e5b91a8fc1fd64d8/license/",
    "status": "visible"
}

URL Allowed Methods

https://archive.softwareheritage.org/api/1/content/[ (hash_type) :] (hash) /

GET, HEAD, OPTIONS

Arguments

hash_type (string)

optional parameter specifying which hashing algorithm has been used to compute the content checksum. It can be either sha1, sha1_git, sha256 or blake2s256. If that parameter is not provided, it is assumed that the hashing algorithm used is sha1.

hash (string)

hexadecimal representation of the checksum value computed with the specified hashing algorithm.


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

object

an object containing the following keys:

  • checksums (object): object holding the computed checksum values for the requested content

  • data_url (string): link to /api/1/content/raw/ for downloading the content raw bytes

  • filetype_url (string): link to /api/1/content/filetype/ for getting information about the content MIME type

  • language_url (string): link to /api/1/content/language/ for getting information about the programming language used in the content

  • length (number): length of the content in bytes

  • license_url (string): link to /api/1/content/license/ for getting information about the license of the content


HTTP status codes

200

no error

400

an invalid hash_type or hash has been provided

404

requested content cannot be found in the archive


Examples

/api/1/content/sha1_git:fe95a46679d128ff167b7c55df5d02356c5a1ae1/
back to top