.. note:: Please read the :doc:`Developer Guide<guide_developer>` first before reading this reference.
.. note:: Please read the :doc:`Developer Guide<guide_developer>` first before reading this reference; it contains examples on how to use the API.
Overview
...
...
@@ -17,81 +17,325 @@ Overview
This document provides a schema reference to the PEDASI Applications API which is used by third-party applications to request data, metadata, or provenance records from a PEDASI instance and its data sources.
Using the API
-------------
API Endpoints
^^^^^^^^^^^^^
-------------
--------
GET /api/datasources/
^^^^^^^^^^^^^^^^^^^^^
Params:
TODO
Retrieves the list of all data sources known to PEDASI, that the authenticated user has the ability to see. This will include some sources which they are unable to use, but have not had their details hidden.
Implementation notes:
Retrieves the list of all data sources known to PEDASI, that the authenticated user has the ability to see. This will include some sources which they are unable to use, but have not had their details hidden.
Parameters:
None
Response class (Status 200): application/json
.. code-block:: json
[
{
"id": 0,
"name": "string",
"description": "string",
"url": "string",
"plugin_name": "string",
"licence": {
"name": "string",
"short_name": "string",
"version": "string",
"url": "string"
},
"is_encrypted": true,
"encrypted_docs_url": "string",
"metadata_items": [
{
"field": {
"name": "string",
"short_name": "string"
},
"value": "string"
}
]
}
]
Responses messages:
.. list-table::
:widths: 16 80 16
:header-rows: 1
* - HTTP Status Code
- Reason
- Response
* -
-
-
--------
GET /api/datasources/<int>/
^^^^^^^^^^^^^^^^^^^^^^^^^^^
GET /api/datasources/{datasource_id}/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Implementation notes:
Retrieves the PEDASI metadata for a given data source, if the authenticated user has the ability to see it.
Parameters:
.. list-table::
:widths: 16 80 16
:header-rows: 1
* - Parameter
- Description
- Type
* - datasource_id
- The numeric id of the data source
- integer
Response class (Status 200): application/json
.. code-block:: json
{
"id": 0,
"name": "string",
"description": "string",
"url": "string",
"plugin_name": "string",
"licence": {
"name": "string",
"short_name": "string",
"version": "string",
"url": "string"
},
"is_encrypted": true,
"encrypted_docs_url": "string",
"metadata_items": [
{
"field": {
"name": "string",
"short_name": "string"
},
"value": "string"
}
]
}
--------
Retrieves the PEDASI metadata for a given data source, if the authenticated user has the ability to see it.
GET /api/datasources/{datasource_id}/metadata/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Implementation notes:
Retrieves metadata for a given data source via an API query to the data source, if supported by the data source. The authenticated user must have META permissions or above to access the data source. E.g. A HyperCat catalogue
GET /api/datasources/<int>/metadata/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Parameters:
.. list-table::
:widths: 16 80 16
:header-rows: 1
Params:
Any supported by data source API
Retrieves metadata via an API query to a data source. The authenticated user must have permission to use the given data source.
* - Parameter
- Description
- Type
E.g. A HyperCat catalogue
* - datasource_id
- The numeric id of the data source
- integer
--------
GET /api/datasources/<int>/metadata/<int>/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
GET /api/datasources/<int>/metadata/<URI>/ (maybe)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
GET /api/datasources/{datasource_id}/metadata/{dataset_id}/
Retrieves metadata for a single dataset contained within the given data source via an API query to the data source. The authenticated user must have permission to use the given data source. E.g. An entry within a HyperCat catalogue
Parameters:
.. list-table::
:widths: 16 80 16
:header-rows: 1
Retrieves metadata for a single dataset contained within the source via an API query to the data source. The authenticated user must have permission to use the given data source.
* - Parameter
- Description
- Type
E.g. An entry within a HyperCat catalogue
* - datasource_id
- The numeric id of the data source
- integer
* - dataset_id
- The numeric id of the data set within the specific data source
- integer
GET /api/datasources/<int>/data/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* - dataset_uri
- The uri of the data set within the specific data source
- integer
--------
Params:
Any supported by data source API
In the case where a data source represents a single dataset, retrieve the dataset via an API query to the data source. The authenticated user must have permission to use the given data source.
GET /api/datasources/{datasource_id}/data/?{query_string}
If the data source does not represent a single dataset, error.
Implementation notes:
In the case where a data source represents a single dataset, retrieve the dataset via an API query to the data source using the given query string. The authenticated user must have permission to use the given data source.
If the data source does not represent a single dataset, error.
Parameters:
.. list-table::
:widths: 16 80 16
:header-rows: 1
GET /api/datasources/<int>/data/<int>/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
GET /api/datasources/<int>/data/<URI>/ (maybe)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* - Parameter
- Description
- Type
Params:
In the case where a data source represents multiple datasets, retrieve a single dataset via an API query to the data source. The authenticated user must have permission to use the given data source.
* - datasource_id
- The numeric id of the data source
- integer
* - query_string
- An ampersand-separated set of key=value pairs
- string
Response class (Status 200): application/json
Dependent on data source
--------
If the data source represents a single dataset, error.
GET /api/datasources/{datasource_id}/data/{dataset_id}/
In the case where a data source represents multiple datasets, retrieve a single dataset via an API query to the data source. The authenticated user must have permission to use the given data source.
If the data source represents a single dataset, error.
GET /api/datasources/<int>/prov/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Params:
TODO
Retrieve all PROV records related to a single data source.
Parameters:
.. list-table::
:widths: 16 80 16
:header-rows: 1
* - Parameter
- Description
- Type
GET /api/datasources/<int>/prov/<int>/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* - datasource_id
- The numeric id of the data source
- integer
Retrieve a single PROV record related to a the data source.
* - dataset_id
- The numeric id of the data set within the specific data source
- integer
* - dataset_uri
- The uri of the data set within the specific data source
- integer
Response class (Status 200): application/json
Dependent on data source
--------
GET /api/datasources/{datasource_id}/prov/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Implementation notes:
Retrieve all PROV records related to a single data source.
Parameters:
.. list-table::
:widths: 16 80 16
:header-rows: 1
* - Parameter
- Description
- Type
* - datasource_id
- The numeric id of the data source
- integer
Response class (Status 200): application/json
.. code-block:: json
{
"prov": [
{
"_id": {
"$oid": "string"
},
"prefix": {
"piot": "string",
"foaf": "string"
},
"entity": {
"string": {
"prov:type": "string",
"xsd:anyURI": "string"
}
},
"activity": {
"string": {
"prov:startTime": "string",
"prov:type": "string"
}
},
"agent": {
"string": {
"prov:type": "string"
},
"piot:app-pedasi": {
"prov:type": "string",
"xsd:anyURI": "string"
}
},
"actedOnBehalfOf": {
"_:id1": {
"prov:delegate": "string",
"prov:responsible": "string",
"prov:activity": "string",
"prov:type": "string"
}
}
}
]
}
--------
GET /api/datasources/{datasource_id}/prov/{dataset_id}/