swh.web.api.views.identifiers module#

swh.web.api.views.identifiers.api_resolve_swhid(request: Request, swhid: str)[source]#
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:
Status Codes:

Example:

https://archive.softwareheritage.org/api/1/resolve/swh:1:rev:96db9023b881d7cd9f379b0c154650d6c108e9a3;origin=https://github.com/openssl/openssl/
swh.web.api.views.identifiers.api_swhid_known(request: Request)[source]#
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:
Status Codes: