SWHIDs (SoftWare Hash IDentifiers)#
- GET /api/1/resolve/(swhid)/#
- Resolve a SoftWare Hash IDentifier (SWHID) - Try to resolve a provided SoftWare Hash IDentifier into an url for browsing the pointed archive object. - If the provided identifier is valid, the existence of the object in the archive will also be checked. - Parameters:
- swhid (string) – a SoftWare Hash IDentifier 
 
- Response JSON Object:
- browse_url (string) – the url for browsing the pointed object 
- metadata (object) – object holding optional parts of the SWHID 
- namespace (string) – the SWHID namespace 
- object_id (string) – the hash identifier of the pointed object 
- object_type (string) – the type of the pointed object 
- scheme_version (number) – the scheme version of the SWHID 
 
- 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 
 
- Status Codes:
- 200 OK – no error 
- 400 Bad Request – an invalid SWHID has been provided 
- 404 Not Found – the pointed object does not exist in the archive 
 
 - Example: - https://archive.softwareheritage.org/api/1/resolve/swh:1:rev:96db9023b881d7cd9f379b0c154650d6c108e9a3;origin=https://github.com/openssl/openssl/ 
- POST /api/1/known/#
- Check if a list of objects are present in the Software Heritage archive. - The objects to check existence must be provided using SoftWare Hash IDentifiers. - Request JSON Array of Objects:
- - (string) – input array of SWHIDs, its length cannot exceed 1000. 
 
- Response JSON Object:
- <swhid> (object) – - an object whose keys are input SWHIDs and values objects with the following keys: - known (bool): whether the object was found 
 
 
- 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 
 
- Status Codes:
- 200 OK – no error 
- 400 Bad Request – an invalid SWHID was provided 
- 413 Request Entity Too Large – the input array of SWHIDs is too large 
 
 
- GET /api/1/raw/(swhid)/#
- Get the object corresponding to the SWHID in raw form. - This endpoint exposes the internal representation (see the - *_git_objectfunctions in- swh.model.git_objects), and so can be used to fetch a binary blob which hashes to the same identifier.- Parameters:
- swhid (string) – the object’s SWHID 
 
- Response Headers:
- Content-Type – application/octet-stream 
 
- Status Codes:
- 200 OK – no error 
- 404 Not Found – the requested object cannot be found in the archive 
 
 - Example: - https://archive.softwareheritage.org/api/1/raw/swh:1:snp:6a3a2cf0b2b90ce7ae1cf0a221ed68035b686f5a