Fixed REST API

This commit is contained in:
Luca Frosini 2021-09-27 18:29:23 +02:00
parent 2b71d1db12
commit 4592036a7c
1 changed files with 43 additions and 3 deletions

View File

@ -225,7 +225,7 @@ public class Access extends BaseRest {
* https://orientdb.com/docs/last/SQL-Syntax.html </a> <br />
* <br />
*
* 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 {