Content#
- GET /api/1/content/known/(sha1)[,(sha1), ...,(sha1)]/#
Check whether some content(s) (aka “blob(s)”) is present in the archive based on its sha1 checksum.
- Parameters:
sha1 (string) – hexadecimal representation of the sha1 checksum value for the content to check existence. Multiple values can be provided separated by ‘,’.
- Request Headers:
Accept – the requested response content type, either
application/json
(default) orapplication/yaml
- Response Headers:
Content-Type – this depends on Accept header of request
- Response JSON Object:
search_res (array) – array holding the search result for each provided sha1
search_stats (object) – some statistics regarding the number of sha1 provided and the percentage of those found in the archive
- Status Codes:
200 OK – no error
400 Bad Request – an invalid sha1 has been provided
Example:
https://archive.softwareheritage.org/api/1/content/known/dc2830a9e72f23c1dfebef4413003221baa5fb62,0c3f19cb47ebfbe643fb19fa94c874d18fa62d12/
- GET /api/1/content/[(hash_type):](hash)/#
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.
- Parameters:
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
orblake2s256
. If that parameter is not provided, it is assumed that the hashing algorithm used issha1
.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) orapplication/yaml
- Response Headers:
Content-Type – this depends on Accept header of request
- Response JSON Object:
checksums (object) – object holding the computed checksum values for the requested content
data_url (string) – link to
GET /api/1/content/[(hash_type):](hash)/raw/
for downloading the content raw bytesfiletype_url (string) – link to
GET /api/1/content/[(hash_type):](hash)/filetype/
for getting information about the content MIME typelanguage_url (string) – link to
GET /api/1/content/[(hash_type):](hash)/language/
for getting information about the programming language used in the contentlength (number) – length of the content in bytes
license_url (string) – link to
GET /api/1/content/[(hash_type):](hash)/license/
for getting information about the license of the content
- Status Codes:
200 OK – no error
400 Bad Request – an invalid hash_type or hash has been provided
404 Not Found – requested content cannot be found in the archive
Example:
https://archive.softwareheritage.org/api/1/content/sha1_git:fe95a46679d128ff167b7c55df5d02356c5a1ae1/
- GET /api/1/content/[(hash_type):](hash)/raw/#
Get the raw content of a content object (aka a “blob”), as a byte sequence.
- Parameters:
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
orblake2s256
. If that parameter is not provided, it is assumed that the hashing algorithm used issha1
.hash (string) – hexadecimal representation of the checksum value computed with the specified hashing algorithm.
- Query Parameters:
filename (string) – if provided, the downloaded content will get that filename
- Response Headers:
Content-Type – application/octet-stream
- Status Codes:
200 OK – no error
400 Bad Request – an invalid hash_type or hash has been provided
404 Not Found – requested content cannot be found in the archive
Example:
https://archive.softwareheritage.org/api/1/content/sha1:dc2830a9e72f23c1dfebef4413003221baa5fb62/raw/
- GET /api/1/content/[(hash_type):](hash)/filetype/#
Get information about the detected MIME type of a content object.
- Parameters:
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
orblake2s256
. If that parameter is not provided, it is assumed that the hashing algorithm used issha1
.hash (string) – hexadecimal representation of the checksum value computed with the specified hashing algorithm.
- Response JSON Object:
content_url (object) – link to
GET /api/1/content/[(hash_type):](hash)/
for getting information about the contentencoding (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
- Request Headers:
Accept – the requested response content type, either
application/json
(default) orapplication/yaml
- Response Headers:
Content-Type – this depends on Accept header of request
- Status Codes:
200 OK – no error
400 Bad Request – an invalid hash_type or hash has been provided
404 Not Found – requested content cannot be found in the archive
Example:
https://archive.softwareheritage.org/api/1/content/sha1:dc2830a9e72f23c1dfebef4413003221baa5fb62/filetype/
- GET /api/1/content/[(hash_type):](hash)/language/#
Get information about the programming language used in a content object.
Note: this endpoint currently returns no data.
- Parameters:
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
orblake2s256
. If that parameter is not provided, it is assumed that the hashing algorithm used issha1
.hash (string) – hexadecimal representation of the checksum value computed with the specified hashing algorithm.
- Response JSON Object:
content_url (object) – link to
GET /api/1/content/[(hash_type):](hash)/
for getting information about the contentid (string) – the sha1 identifier of the content
lang (string) – the detected programming language if any
tool (object) – information about the tool used to detect the programming language
- Request Headers:
Accept – the requested response content type, either
application/json
(default) orapplication/yaml
- Response Headers:
Content-Type – this depends on Accept header of request
- Status Codes:
200 OK – no error
400 Bad Request – an invalid hash_type or hash has been provided
404 Not Found – requested content cannot be found in the archive
Example:
https://archive.softwareheritage.org/api/1/content/sha1:dc2830a9e72f23c1dfebef4413003221baa5fb62/language/
- GET /api/1/content/[(hash_type):](hash)/license/#
Get information about the license of a content object.
- Parameters:
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
orblake2s256
. If that parameter is not provided, it is assumed that the hashing algorithm used issha1
.hash (string) – hexadecimal representation of the checksum value computed with the specified hashing algorithm.
- Response JSON Object:
content_url (object) – link to
GET /api/1/content/[(hash_type):](hash)/
for getting information about the contentid (string) – the sha1 identifier of the content
licenses (array) – array of strings containing the detected license names
tool (object) – information about the tool used to detect the license
- Request Headers:
Accept – the requested response content type, either
application/json
(default) orapplication/yaml
- Response Headers:
Content-Type – this depends on Accept header of request
- Status Codes:
200 OK – no error
400 Bad Request – an invalid hash_type or hash has been provided
404 Not Found – requested content cannot be found in the archive
Example:
https://archive.softwareheritage.org/api/1/content/sha1:dc2830a9e72f23c1dfebef4413003221baa5fb62/license/