Difference between revisions of "Resource Registry Service - Query & Access"
Luca.frosini (Talk | contribs) (→Get Instance) |
Luca.frosini (Talk | contribs) (→Get All Instances of a Specific Type) |
||
Line 48: | Line 48: | ||
=== Get All Instances of a Specific Type === | === Get All Instances of a Specific Type === | ||
− | <pre>GET /resource-registry/access/instances/{ER | + | <pre>GET /resource-registry/access/instances/{ER Type}?[polymorphic=(true|false)][&reference={Instance UUID}][&direction=(in|out|both)]</pre> |
Default: | Default: | ||
− | + | * polymorphic : false | |
− | + | * direction : both | |
direction has sense only if reference UUID is provided, is ignored otherwise. | direction has sense only if reference UUID is provided, is ignored otherwise. | ||
Line 60: | Line 60: | ||
<pre>GET /resource-registry/access/instances/EService?polymorphic=true&reference=4d28077b-566d-4132-b073-f4edaf61dcb9&direction=(in|out|both)</pre> | <pre>GET /resource-registry/access/instances/EService?polymorphic=true&reference=4d28077b-566d-4132-b073-f4edaf61dcb9&direction=(in|out|both)</pre> | ||
− | |||
− | |||
=== Get Filtered Resource Instances === | === Get Filtered Resource Instances === |
Revision as of 11:24, 9 November 2017
This sections provide information regarding how to interact with Resource Registry Service for Query and Access. REST and JAVA API are presented for each functionality.
Please note that the provided examples can intentionally hide some details in the response to avoid unneeded complexity.
Apart the REST API this port type can be used also by using Resource Registry Client java client.
Resource Registry Client has the following maven coordinates
<dependency> <groupId>org.gcube.information-system</groupId> <artifactId>resource-registry-client</artifactId> <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> </dependency>
To use the client you need first get a ResourceRegistryClient instance.
By using ResourceRegistryClientFactory.create() method the library discover the correct endpoint to interact with the Resource Registry for the current context.
SecurityTokenProvider.instance.set("Your-NextNext-Token-Here"); //If not already set ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();
Exists
HEAD /resource-registry/access/instance/{ER Type}/{Instance UUID}
Example
HEAD /resource-registry/access/instance/ContactFacet/4d28077b-566d-4132-b073-f4edaf61dcb9
Get Instance
GET /resource-registry/access/instance/{ER Type}/{Instance UUID}
Example
GET /resource-registry/access/instance/ContactFacet/4d28077b-566d-4132-b073-f4edaf61dcb9
Get All Instances of a Specific Type
GET /resource-registry/access/instances/{ER Type}?[polymorphic=(true|false)][&reference={Instance UUID}][&direction=(in|out|both)]
Default:
- polymorphic : false
- direction : both
direction has sense only if reference UUID is provided, is ignored otherwise.
GET /resource-registry/access/instances/EService?polymorphic=true
GET /resource-registry/access/instances/EService?polymorphic=true&reference=4d28077b-566d-4132-b073-f4edaf61dcb9&direction=(in|out|both)
Get Filtered Resource Instances
GET /resource-registry/access/resourceInstances/{ResourceType}/{ConsistsOfType}/{FacetType}?[polymorphic=(true|false)]&key1=value1&key2=value2&...
Default:
- polymorphic : false
GET /resource-registry/access/resourceInstances/EService/IsIdentifiedBy/SoftwareFacet?polymorphic=true&group=DataAccess&name=HomeLibraryWebapp
public <R extends Resource> List<R> getFilteredResources(Class<R> resourceClass, Class<? extends ConsistsOf> consistsOfClass, Class<? extends Facet> facetClass,boolean polymorphic, Map<String, Object> map) throws ResourceRegistryException
Map<String, Object> map = new HashMap<>(); map.put("group", "DataAccess"); map.put("name", "HomeLibraryWebapp"); List<EService> eServices = resourceRegistryClient.getFilteredResources(EService.class, IsIdentifiedBy.class, SoftwareFacet.class, true, map);
public List<Resource> getFilteredResources(String resourceType, String consistsOfType, String facetType, boolean polymorphic, Map<String, Object> map) throws ResourceRegistryException;
Raw Query
GET /resource-registry/access?query=SELECT FROM Facet