Changeset View
Changeset View
Standalone View
Standalone View
docs/getting-started/api.rst
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
The syntax mentioned in the `API | The syntax mentioned in the `API | ||||
documentation <https://archive.softwareheritage.org/api/1/>`__ is rather | documentation <https://archive.softwareheritage.org/api/1/>`__ is rather | ||||
straightforward. Since we want to read it from the main Software | straightforward. Since we want to read it from the main Software | ||||
Heritage server, we will use ``https://archive.softwareheritage.org/`` | Heritage server, we will use ``https://archive.softwareheritage.org/`` | ||||
as the basename. All API calls will be forged according to the same | as the basename. All API calls will be forged according to the same | ||||
syntax: | syntax: | ||||
:: | ``https://archive.softwareheritage.org/api/1/<endpoint>`` | ||||
https://archive.softwareheritage.org/api/1/<endpoint> | |||||
Request basic Information | Request basic Information | ||||
------------------------- | ------------------------- | ||||
We want to get some basic information about the main server activity and | We want to get some basic information about the main server activity and | ||||
content. The ``stat`` endpoint provides a summary of the main indexes and | content. The ``stat`` endpoint provides a summary of the main indexes and | ||||
some statistics about the archive. We can request a GET on the main | some statistics about the archive. We can request a GET on the main | ||||
counters of the archive using the counters path, as described in the | counters of the archive using the counters path, as described in the | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^ | ||||
The easiest way to look for a keyword in the repositories analysed by | The easiest way to look for a keyword in the repositories analysed by | ||||
the archive is to use the ``search`` feature of the ``origin`` endpoint. | the archive is to use the ``search`` feature of the ``origin`` endpoint. | ||||
Documentation for the endpoint is | Documentation for the endpoint is | ||||
`here <https://archive.softwareheritage.org/api/1/origin/search/doc/>`__ | `here <https://archive.softwareheritage.org/api/1/origin/search/doc/>`__ | ||||
and the complete syntax is: | and the complete syntax is: | ||||
:: | ``/api/1/origin/search/<keyword>/`` | ||||
`/api/1/origin/search/<keyword>/` | |||||
The server returns an array of hashes, with each item being formatted | The server returns an array of hashes, with each item being formatted | ||||
as: | as: | ||||
- **origin_visits_url** attribute is an URL that points to the API page | - **origin_visits_url** attribute is an URL that points to the API page | ||||
listing all visits (bot fetches) to this repository. | listing all visits (bot fetches) to this repository. | ||||
- **url** is the url of the origin, or repository, itself. | - **url** is the url of the origin, or repository, itself. | ||||
▲ Show 20 Lines • Show All 475 Lines • Show Last 20 Lines |