Resource Registry Service - Query Templates Management
These sections provide information regarding how to interact with Resource Registry Service for query templates management. This page presents REST and JAVA API for each functionality.
Please note that the provided examples can intentionally hide some details to avoid unneeded complexity.
Query Templates Management
Query Templates Management is responsible for the management of query templates. It offers the following APIs:
- List: it allows to list query templates;
- Create: it allows to create a new query template;
- Exists: it allows to check if an query template exists;
- Read: it allows to read a query template;
- Update: it allows to update a query template;
- Delete: it allows to delete a query template.
The Query Templates Management implements the following policies:
- it manages the Header automatically;
- it allows identifying an instance via the Universally Unique Identifier (UUID) specified in the Header;
- it validates the query templates by applying the provided default values and running the generated query.
Query Template Collection
The following table shows the exposed APIs as REST Collection.
Operation | HTTP Method | URL |
---|---|---|
List | GET | /query-templates
|
Create | PUT | /query-templates/{QUERY_TEMPLATE_NAME}
|
Exists | HEAD | /query-templates/{QUERY_TEMPLATE_NAME}
|
Read | GET | /query-templates/{QUERY_TEMPLATE_NAME}
|
Update | PUT | /query-templates/{QUERY_TEMPLATE_NAME}
|
Run | POST | /query-templates/{QUERY_TEMPLATE_NAME}
|
Delete | DELETE | /query-templates/{QUERY_TEMPLATE_NAME}
|
Resource Registry Query Template Client
NOT YET AVAILABLE - UNDER IMPLEMENTATION
Resource Registry Query Template Client is a java library providing RPC facilities to interact with Query Templates Management.
To use the Java library to interact with Query Template collection declare the following dependency in your pom.xml file.
<dependency> <groupId>org.gcube.information-system</groupId> <artifactId>resource-registry-query-templates-client</artifactId> <version>[1.0.0,2.0.0-SNAPSHOT)</version> <dependency>
To use the client you just need to instantiate the client via the provided factory.
import org.gcube.informationsystem.resourceregistry.queries.templates.ResourceRegistry...Client; import org.gcube.informationsystem.resourceregistry.queries.templates.ResourceRegistry...Factory; ... ResourceRegistry...Client resourceRegistry...Client = ResourceRegistry...Factory.create();
The provided client exposes the available methods and options as explained below.
The source code of the resource-registry-query-templates-client is available at https://code-repo.d4science.org/gCubeSystem/resource-registry-query-templates-client
APIs
List Query Templates
List via Java Client
Signature
...
List via Java Client Example
The following snippet of code shows how to list all the query templates.
...
List via REST API
List via REST API Example
The following request shows how to retrieve all the resource instances.
Request URL
GET /query-templates
Create Query Template
Create via Java Client
Signature
...
Create via Java Client Example
...
Create via REST API
PUT /query-templates/{QUERY_TEMPLATE_NAME}
Create via REST API Resource Example
The following listing shows an example of EService representation to be created.
Request URL
PUT /query-templates/GetAllEServiceWithState
Request Body
{ "name" : "GetAllEServiceWithState", "description": "The following query return all the EService having the state provided as parameters, e.g. down, ready. The content of the request to run this query template will be something like {"$state": "ready"}", "template": { "@class": "EService", "consistsOf": [{ "@class": "ConsistsOf", "target": { "@class": "StateFacet", "value": "$state" } }] }, "templateVariables" = { "$state" : { "name": "$state", "description": "The state of the EService, e.g. down, ready.", "defaultValue": "ready" } } }
The following listing contains the response of the service :
Response Body
...
Read Query Template
Read via Java Client
...
Read via Java Client Example
...
Read via REST API
GET /query-templates/{QUERY_TEMPLATE_NAME}
Read via REST Example
In the example, ...
Request URL
GET /query-templates/{.....}
Response Body
...
Update Instance
Update via Java Client
Signature
...
Update via Java Client Example
...
Update via REST API
PUT /query-templates/{QUERY_TEMPLATE_NAME}
Update via REST API Example
Request URL
PUT /query-templates/{...}
Request Body
...
Response Body
...
Run Query Template
Run via Java Client
...
Run via Java Client Example
...
Run via REST API
DELETE /query-templates/{...}
Run via REST Example
Request URL
DELETE /query-templates/{...}
Delete Query Template
Delete via Java Client
...
Delete via Java Client Example
...
Delete via REST API
DELETE /query-templates/{...}
Delete via REST Example
Request URL
DELETE /query-templates/{...}