From 4592036a7cec6fd9f4f93f12e06d7053eac7fbce Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 27 Sep 2021 18:29:23 +0200 Subject: [PATCH] Fixed REST API --- .../resourceregistry/rest/Access.java | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java index 197c55e..b1b7cec 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java @@ -225,7 +225,7 @@ public class Access extends BaseRest { * https://orientdb.com/docs/last/SQL-Syntax.html
*
* - * e.g. GET /access/graph-query?q=SELECT FROM V&limit=20&fetchPlan=*:-1 + * e.g. GET /access/query?q=SELECT FROM V&limit=20&fetchPlan=*:-1 * * @param query Defines the query to send to the backend. * @param limit Defines the number of results you want returned (default 20, use -1 to unbounded results) @@ -238,7 +238,7 @@ public class Access extends BaseRest { * @throws InvalidQueryException if the query is invalid or not idempotent */ @GET - @Path(AccessPath.GRAPH_QUERY_PATH_PART) + @Path(AccessPath.QUERY_PATH_PART) @Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8) public String graphQuery(@QueryParam(AccessPath.QUERY_PARAM) String query, @QueryParam(AccessPath.LIMIT_PARAM) Integer limit, @@ -255,7 +255,47 @@ public class Access extends BaseRest { return queryManager.query(query, limit, fetchPlan, raw); } - + /** + * POST /access/query + * + * Content Body example: + * + * { + * "@class": "EService", + * "consistsOf": [ + * { + * "@class": "ConsistsOf", + * "propagationConstraint" : { + * "add": "propagate" + * }, + * "target": { + * "@class": "StateFacet", + * "value": "down" + * } + * }, + * { + * "@class": "IsIdentifiedBy", + * "target": { + * "@class": "SoftwareFacet", + * "name": "data-transfer-service", + * "group": "DataTransfer" + * } + * }, + * { + * "@class": "ConsistsOf", + * "target": { + * "@class": "AccessPointFacet", + * "endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service" + * } + * } + * ] + * } + * + * @param jsonQuery + * @return + * @throws InvalidQueryException + * @throws ResourceRegistryException + */ @POST @Path(AccessPath.QUERY_PATH_PART) public String jsonQuery(String jsonQuery) throws InvalidQueryException, ResourceRegistryException {