swh.web.api.views.origin_save module

swh.web.api.views.origin_save.api_save_origin(request, visit_type, origin_url)[source]
GET /api/1/origin/save/(visit_type)/url/(origin_url)/
POST /api/1/origin/save/(visit_type)/url/(origin_url)/

Request the saving of a software origin into the archive or check the status of previously created save requests.

That endpoint enables to create a saving task for a software origin through a POST request.

Depending of the provided origin url, the save request can either be:

  • immediately accepted, for well known code hosting providers like for instance GitHub or GitLab

  • rejected, in case the url is blacklisted by Software Heritage

  • put in pending state until a manual check is done in order to determine if it can be loaded or not

Once a saving request has been accepted, its associated saving task status can then be checked through a GET request on the same url. Returned status can either be:

  • not created: no saving task has been created

  • not yet scheduled: saving task has been created but its execution has not yet been scheduled

  • scheduled: the task execution has been scheduled

  • succeeded: the saving task has been successfully executed

  • failed: the saving task has been executed but it failed

When issuing a POST request an object will be returned while a GET request will return an array of objects (as multiple save requests might have been submitted for the same origin).

Parameters
  • visit_type (string) – the type of visit to perform (currently the supported types are git, hg and svn)

  • origin_url (string) – the url of the origin to save

Request Headers
  • Accept – the requested response content type, either application/json (default) or application/yaml

Response Headers
Response JSON Object
  • origin_url (string) – the url of the origin to save

  • visit_type (string) – the type of visit to perform

  • save_request_date (string) – the date (in iso format) the save request was issued

  • save_request_status (string) – the status of the save request, either accepted, rejected or pending

  • save_task_status (string) – the status of the origin saving task, either not created, not yet scheduled, scheduled, succeeded or failed

Status Codes