Description

Get information about the detected MIME type of a content object.

Request

GET https://archive.softwareheritage.org/api/1/content/sha1_git:6a05643838bb4ef64ae093f7a0f816a80d6f09f4/filetype/

Response

Body
{
    "content_url": "https://archive.softwareheritage.org/api/1/content/sha1:de26417bb7aa146bb6a9abfcfe820466e80f08fe/",
    "encoding": "us-ascii",
    "id": "de26417bb7aa146bb6a9abfcfe820466e80f08fe",
    "mimetype": "text/x-c++",
    "tool": {
        "configuration": {
            "debian-package": "python3-magic",
            "type": "library"
        },
        "id": 9,
        "name": "file",
        "version": "1:5.30-1+deb9u1"
    }
}

URL Allowed Methods

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

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:

  • content_url (object): link to /api/1/content/ for getting information about the content

  • encoding (string): the detected content encoding

  • id (string): the sha1 identifier of the content

  • mimetype (string): the detected MIME type of the content

  • tool (object): information about the tool used to detect the content filetype


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:dc2830a9e72f23c1dfebef4413003221baa5fb62/filetype/
back to top