Skip to main content
Version: 2.0

GraphGrid Showme

Platform Version 2.0

API Version 1.0

Introduction

Showmes allow dynamic APIs to be created using only Geequel. They support the most common REST methods and return data translated from the Geequel query as JSON. Showmes can be secured to perform authentication and authorization challenges using Geequel. All /1.0/showme endpoints are routed to the Manager service for request processing.

This Showme API version is 1.0 and as such all endpoints are rooted at /1.0/. For example, http://localhost/1.0/showme (requires auth) would be the base context for this Manager API under the GraphGrid API deployed at http://localhost.

tip

Geequel is ONgDB's graph query language, however GraphGrid's API has references to openCypher. API parameters that include 'cypher' equate to Geequel queries. These references will be addressed in future updates to GraphGrid. Click here to learn more about Geequel

Environment

Showmes require the following integrations: ONgDB 1.0+

Showme Options

ShowmeSecurityRules

When creating a Showme, security rules can be added to control who can access the Showme endpoints. When creating or updating a Showme, pass an additional showmeSecurityRules param in the body with the following JSON structure:

{
"showmeSecurityRues:": {
"spelExpression": "permitAll",
"cypherQuery": "WITH principal.name AS name RETURN true"
}
}

Both fields are optional, however when evaluated must return a boolean. Whichever fields are present will be used to check the Showme authorization when a user calls the Showme endpoint. If both are present the spelExpression will be checked before the Geequel query.

The spelExpression param refers to Spring Expression Language expressions (for more details see here).

caution

"@" characters are banned from the expression to prevent access of internal beans and services. You should not need to use "@" in these expressions for most purposes in order to control access.

The cypherQuery param can be any Geequel query you wish, as long as it's read-only and returns a boolean. Ideally it should also return quickly, but this is not required, just a guide, as your Showme may be called multiple times. You can also have parameters that can be filled when the user calls the Showme endpoint as described below. The cypherQuery has access to the User node properties via the alias principal and access to all params.

Calling

For example, if a Geequel query was RETURN {param0} and a user called a showme endpoint with ?params="{\"param0\":true}" , then the Geequel query would be passed a map containing boolean param0->true and be sent with the Geequel query. It would then evaluate to RETURN true and the Geequel check step would pass.

For the spelExpression, no additional steps are necessary here, so long as the calling user fulfills the spring security rules. E.g. for a spelExpression of the following: hasRole('CLIENT_USER') and hasRole('USER') A calling user must have the roles CLIENT_USER and USER in order to successfully call the endpoint.

If either the spelExpression or cypherQuery fails or returns false, the entire call is rejected with status 403.

No User Auth Showmes

All showmes require some form of authentication. By default, showme endpoints can only be accessed with ROLE_USER. Showmes created with the disableUserRoleRequirement property set to true are NoUserAuth showmes. These showmes have separate execute endpoints at /1.0/showme/nouserauth/executeShowme/. These endpoints still require one of the following security roles:

  • CLIENT_INTERNAL
  • CLIENT_FREE
  • CLIENT_USER

Parameters (create only)

Required Params

If a Showme's Geequel is dependent on certain params being passed in (i.e. they are required by the query and no reasonable default exists) an optional requiredParams field is available on create and update requests. requiredParams is a List< String > and supports nested params following a dot notation. E.g., for a request body:

{
"uniqueIdOfActor1": "stringId",
"bodyOfSubObject": {
"noun": "person_place_or_thing",
"number": 5
}
}

If uniqueIdOfActor1 and number are required, requiredParams would be passed in as ["uniqueIdOfActor1","bodyOfSubObject.number"]. (Note that this implicitly requires bodyOfSubObject as well. The option of explicitly including top level objects with required fields or sub objects is left to the discretion of the user.) Note that on update requiredParams is comprehensive (i.e., not additive or subtractive). If an existing Showme with existing requiredParams is updated with null or an empty list, existing requiredParams will be removed.

Bookmarks

You may also pass a "bookmark" param, where you can pass in one or many ONgDB bookmarks to the query in a list. Bookmarks record a point in transactional history and can be used to inform cluster members to carry out units of work in a particular sequence. They are to be formatted ongdb:bookmark:v1:tx1 for transaction 1, for example. A bookmark will also come back in the response of each executed Showme so any call to a Showme can have a bookmark reference.

Snippets

Snippets are Geequel "expressions" that can be reused across Showmes. They are created and maintained separately from any related Showmes, so great caution should be taken when updating/deleting at the risk of breaking dependent Showmes. They can optionally be chained with a Showme with its own cypher or without.

Snippets are referenced in showme Geequel statements using the following format $$snippet0, $snippet1, ... $snippet<n>. In the showme request object, the values of snippetMap[0], snippetMap[1], and snippetMap[n] are grns referencing specific snippets, with $$snippet0 being replaced by Geequel from snippetMap[0] and so on.

Snippets can also optionally have input and/or output maps. A snippet with these maps can have placeholder variables and aliases (indicated by a double dollar sign: $$) that will be replaced using a SnippetImpl for each individual Showme for which the mapped snippet is included. If a snippetImpl is not provided or not all of the inputs/outputs from the snippet are mapped within the snippetImpl, the default variables will be used. Variables for properties must be provided by the snippetImpl map or the snippetImpl creation will be rejected.

Validation

There is as much validation as possible on snippet inclusion and snippetImpl creation (which is included in Showme creation, not a separate operation, as each snippetImpl is Showme-specific), but some validation is not possible until an attempt to run the Showme.

Validation errors on create

  • Geequel not included on snippet map

If a Showme is created with explicit Geequel and a snippet map, one of two things is required: (a) Including a cypherOrder (Integer) property on the create update request. This is zero-based and indicates the insertion of the Geequel relative to the provided snippets (e.g., if 2 snippet grns are provided and cypherOrder = 1, final ordering will be snippet with grn 1, explicit Showme Geequel, snippet with grn 2) (b) Overriding Geequel with overrideCypherOrder = true on the create/update request. This will not include the explicit showme Geequel and will interpret the final statement using only the Geequel snippets. (An example use case being a Showme formerly used explicit Geequel and no longer needs to, so override has been implemented to preserve the Geequel persisted in the graph in case of future reversion but not use it in Showme execution.)

  • Invalid snippet grn provided

If a grn is provided for which a snippet cannot be found, creation/update will be blocked.

  • Invalid snippetImpl grn provided

If a snippetImpl is provided with a grn and a snippetImpl with that grn cannot be found, creation/update will be blocked.

  • No snippet grn provided for snippetImpl creation/update

Snippet grns are required for snippetImpl creation. If no snippet grn is provided for a new snippetImpl, creation/update will be blocked

  • SnippetImpl input map provided for snippet with no inputs

If an input map is provided for a snippetImpl with a snippet that has no defined inputs, creation/update will be blocked.

  • SnippetImpl output map provided for snippet with no outputs

If an output map is provided for a snippetImpl with a snippet that has no defined outputs, creation/update will be blocked.

  • Invalid input key provided

If an input key is provided in the snippetImpl map and a matching key is not found on the snippet's mapped inputs, creation/update will be blocked.

  • Invalid output key provided

If an output key is provided in the snippetImpl map and a matching key is not found on the snippet's mapped outputs, creation/update will be blocked.

Validation errors on execution

Geequel syntax of the final interpreted and mapped statement is not checked on create/update. The following specific errors will be caught and returned as errors before the execution of the Geequel is attempted. Any other syntax errors will return as Geequel syntax errors when attempting to execute interpreted Geequel.

  • Remaining property inputs after resolving impl input/output map(s)

Properties cannot be dynamically entered using params. All property types must be mapped by a snippetImpl. Once mapped inputs/outputs have been resolved if any property inputs/outputs remain unmapped, execution will not be attempted. The resulting error message will indicate if an existing snippetImpl has insufficient mapped inputs or if a snippetImpl is missing entirely.

  • Remaining aliased nodes/relationships after resolving input/output map(s)

Nodes and relationships cannot be dynamically aliased using params. All node and relationship aliases must be mapped by a snippetImpl. Once mapped inputs outputs have been resolved if any node or relationship inputs/outputs remain unmapped, execution will not be attempted. The resulting error message will indicate if an existing snippetImpl has insufficient mapped inputs or if a snippetImpl is missing entirely.

Examples

Snippets with no mapping

Snippet 1 Geequel: MERGE (n:Node {grn:$grn})

Snippet 2 Geequel: SET n.prop1 = $prop

Snippet 3 Geequel: RETURN n.prop1 AS val;

These snippets could all be chained together as-is with a showme with no Geequel and required params $grn and $prop. They could also be used with a showme with Geequel before 1, between 1 and 2, or between 2 and 3 (note that since 3 includes a semicolon at the end, it must be the final snippet in any snippet/showme chain; inclusion of semicolons is completely optional, even if the snippet would only ever be the final expression in a chain).

Example final statement with Showme with no Geequel:

MERGE (n:Node {grn:$grn}) SET n.prop1 = $prop RETURN n.prop1 AS val;

Example final statement with Showme with explicit Geequel $$snippet0 $$snippet1, n.prop2 = $prop2 $$snippet2

MERGE (n:Node {grn:$grn}) SET n.prop1 = $prop, n.prop2 = $prop2 RETURN n.prop1 AS val;

Snippets with mappings

Snippet 1 Geequel: MERGE ($$n:Node {grn:$$grn}) Snippet 1 input map:

{
"n": "Node",
"grn": "String"
}

Snippet 2 Geequel: SET m.$$prop1 = $$prop Snippet 2 input map:

{
"prop1": "Property",
"prop": "Object"
}

Snippet 3 Geequel: RETURN $$s.$$p1 AS $$val; Snippet 3 input map:

{
"s": "Node",
"p1": "Property"
}

Snippet 3 output map:

{
"val": "Object"
}

Note that all 3 snippets require a snippetImpl. Variables n (snippet 1), prop1 (snippet 2), and s and p1 (snippet 3) are mapped inputs of type Property and Node and must be mapped due to property names and nodes not being dynamically assignable. All other mappings would be optional. If no mapping is provided, the default name is used (e.g., if the impl provided for snippet 1 does not include a mapping for grn, it will be interpreted as MERGE (n:Node {grn:$grn}) and if no output mapping is provided by the impl for snippet 3, it will be interpreted as RETURN s.p1 AS val;. Example mappings and final statement: snippetImpl for snippet 1 input map ($$grn intended to be left as-is as a param passed in to the showme, thus, not mapped:

{
"n": "m"
}

snippetImpl for snippet 2 input map (new property value mapped for the sake of example; in a real use case, this would likely be left as a param to be passed in to the showme):

{
"prop1": "name",
"prop": "\"my node's new name\""
}
note

The escaped quotation marks in the hard-coded string value "my node's new name". Escaped quotation marks are required for hard-coded strings in snippetImpls. Neglecting to include the escaped quotation marks will result in a Geequel syntax failure upon running the showme.

snippetImpl for snippet 3 input map:

{
"p1": "name",
"s": "m"
}

Without an output map for snippet 3, the final statement would be: MERGE (m:Node {grn:$grn}) SET m.name = "my node's new name" RETURN m.name AS val;

snippetImpl for snippet 3 output map:

{
"val": "newName"
}

Final statement with output map: MERGE (m:Node {grn:$grn}) SET m.name = "my node's new name" RETURN m.name AS newName;

Routes

Routes provide the ability to chain requests following the execution of a showme. Routes can be absolute or conditional. They are reusable across showmes. Whether or not the route is executed is determined by the relationship set when it is linked to a showme and, if conditional, the truthy value returned with the configured key by the showme. The truthy value for a conditional route must return at the top level of results (i.e., not nested in an object) and a showme with a conditional route must return one row only. If a conditional route exists and the expected key does not return from the showme, the conditional route will be silently ignored, regardless of whether it is a conditional failure or conditional success route; the indicated key must be present at the top level of results and it must be a boolean in order for conditional success or conditional failure routes to be triggered. Absolute success routes will execute if Geequel execution results in a 200 success. Any route linked without one of the explicit relationship options (success, conditional-success, conditional-failure) is assumed to be a failure route and will execute if any errors are encountered before, during, or after Geequel execution. Failure routes are "fire and forget" and, therefore, any result body will not be returned.

Request Sequencers

Request sequencers also provide the ability to chain requests, but unlike routes, request sequencers can chain together any combination of shommes, graphgrid API endpoints and outside APIs. Request sequencers can be triggered by an endpoint in the API, or even by a trigger in RabbitMq.

Update only options

Add params

If update is used for creation, addParams (rather than create params is used to create initial parameters. On update of an existing Showme, addParams will create any new parameters with defaults. As with create's params, be aware that if addParams is included the default values will always be used if the related variable is not provided at request time.

Remove Params

Removes existing parameters' default values from an existing Showme.

Override SnippetImpls

If on update, snippetImpls is passed in as null or empty, it will be ignored unless overrideSnippetImpls is true.

Showme API

caution

Pay attention to capitalization. GraphGrid 2.0.x uses ShowMe in its request URLs (ex. /1.0/showme/createShowMe). GraphGrid 2.0 uses Showme (ex. /1.0/showme/createShowme).

Get Status

Used to check the health of the Showme service. Will return a 200 OK response if healthy.

Base URL: /1.0/showme/status
Method: GET

Create Showme

Creates a new showme.

Base URL: /1.0/showme/createShowme
Method: POST

Request

curl --location --request POST "${API_BASE}/1.0/showme/createShowme" \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-raw '{
"cypher": "MERGE (u:User {grn:{grn}}) SET u.username = {name}, u.mock = true",
"showmeMethod": "POST",
"showmePath": "/create-user",
"showmeDisplayValue": "create-user",
"showmeDefinition": "An example showme",
"showmePopulatorDisplayValue": "create-user",
"showmePopulatorDefinition": "create-user",
"nodeTypeGrns": [],
"params": {},
"requiredParams": [],
"showmeSecurityRules": {
"spelExpression": "permitAll",
"cypherQuery": "WITH principal.name AS name RETURN true"
},
"cypherOrder": 0,
"overrideCypherOrder": false
}'

Response

{
"showme": {
"id": 359,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T17:40:35.329Z",
"updatedAt": "2021-02-18T17:40:35.329Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowme:FacJEeQiJA8xkniwJLVD7WOxcwmhYtASSeEyHlW8jEAk",
"key": "POST /create-user",
"method": "POST",
"path": "/create-user",
"definition": "An example showme",
"displayValue": "create-user",
"order": null,
"disableUserRoleRequirement": null,
"nodeTypes": [],
"showmePopulator": {
"id": 358,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T17:40:35.303Z",
"updatedAt": "2021-02-18T17:40:35.364Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowmepopulator:gJgWBTcjp2K9zNZZbMdv8rqGl7Vbb3WwsJgVH7SGZ1mD",
"cypher": "MERGE (u:User {grn:{grn}}) SET u.username = {name}, u.mock = true",
"displayValue": "create-user",
"definition": "create-user",
"requiredParameters": [],
"searchQuery": null,
"successRoutes": [],
"failureRoutes": [],
"conditionalSuccessRoutes": [],
"conditionalFailureRoutes": [],
"parameters": [],
"snippets": [],
"snippetImpls": null,
"cypherOrder": 0,
"grnType": "graphgridshowmepopulator",
"label": "GraphGridShowmePopulator"
},
"securityRules": {
"id": 333,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T17:40:35.303Z",
"updatedAt": "2021-02-18T17:40:35.303Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowmesecurityrules:NvIbN8nPDUEoGf0mOhT7zHCXB7vvD5iYkASPf4st6gqN",
"spelExpression": "permitAll",
"cypherQuery": "WITH principal.name AS name RETURN true",
"grnType": "graphgridshowmesecurityrules",
"label": "GraphGridShowmeSecurityRules"
},
"grnType": "graphgridshowme",
"label": "GraphGridShowme"
},
"showmePopulator": {
"id": 358,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T17:40:35.303Z",
"updatedAt": "2021-02-18T17:40:35.364Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowmepopulator:gJgWBTcjp2K9zNZZbMdv8rqGl7Vbb3WwsJgVH7SGZ1mD",
"cypher": "MERGE (u:User {grn:{grn}}) SET u.username = {name}, u.mock = true",
"displayValue": "create-user",
"definition": "create-user",
"requiredParameters": [],
"searchQuery": null,
"successRoutes": [],
"failureRoutes": [],
"conditionalSuccessRoutes": [],
"conditionalFailureRoutes": [],
"parameters": [],
"snippets": [],
"snippetImpls": null,
"cypherOrder": 0,
"grnType": "graphgridshowmepopulator",
"label": "GraphGridShowmePopulator"
}
}

Execute Showme

/1.0/showme/executeShowme/{{showmePath}}

Executes a Showme. The HTTP method depends on what was set on creation/update. Params and response are completely dependent on how the Showme has been configured and what the Geequel returns. Params can be passed in the URL or as an object body (where appropriate for the specified HTTP method). E.g.: http://localhost/1.0/showme/executeShowme/myShowme?params={"param1":"paramValue","param2":2345} or see below for a request with params passed in an object body.

caution

Parameters must be URL encoded for GET requests. The { symbol should be replaced with %7B and } with %7D.

Executes a showme

Base URL: /1.0/showme/executeShowme/{{showmename}}
Method: POST/PUT/GET/PATCH/DELETE

Parameters

ParameterDescription
showmePathThe stored path of the Showme or the Showme's grn.
paramsOptional as a url param; a json representation of the params indicated by the Showme configuration. This json can optionally be sent as a body instead depending on the configured HTTP method.

Request

curl --location --request POST "${API_BASE}/1.0/showme/executeShowme/create-user" \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Test User",
"grn": "grn:gg:user:testuser1"
}'

Response

{
"results": [],
"bookmark": "ongdb:bookmark:v1:tx473",
"errors": []
}

Update Showme

Updates a showme

Base URL: /1.0/showme/updateShowme
Method: PUT

Request

curl --location --request PUT "${API_BASE}/1.0/showme/updateShowme/create-user" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"cypher" : "$$snippet0",
"showmeMethod" : "POST",
"showmePath" : "/create-user",
"showmeDisplayValue" : "showmeThatUsesSnippet",
"showmeDefinition" : "showmeThatUsesSnippet",
"showmePopulatorDisplayValue" : "showmeThatUsesSnippet",
"showmePopulatorDefinition" : "showmeThatUsesSnippet ",
"snippetMap":["grn:gg:graphgridshowmecyphersnippet:RxnzcDBqIc1klDTfMWzW6K6cXeJpgbU9tbydfj9amXx9"],
"cypherOrder":0
}'

Response

{
"showme": {
"id": 19,
"labels": [],
"enver": 0,
"createdAt": "2021-02-17T17:54:10.173Z",
"updatedAt": "2021-02-18T15:55:49.04Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowme:31k5yAtzKf5bGmxp2Oi59f2IepNiD7vfssCGJVATdmiu",
"key": "POST /create-user",
"method": "POST",
"path": "/create-user",
"definition": "showmeThatUsesSnippet",
"displayValue": "showmeThatUsesSnippet",
"order": null,
"disableUserRoleRequirement": null,
"nodeTypes": [],
"showmePopulator": null,
"securityRules": null,
"grnType": "graphgridshowme",
"label": "GraphGridShowme"
},
"populator": {
"id": 18,
"labels": [],
"enver": 0,
"createdAt": "2021-02-17T17:54:10.137Z",
"updatedAt": "2021-02-18T15:55:49.057Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowmepopulator:8f2l92UbKm4cnS0FgIKPQY9RQMyOjLWeHLvhDilgj2H3",
"cypher": "$$snippet0",
"displayValue": "showmeThatUsesSnippet",
"definition": "showmeThatUsesSnippet ",
"requiredParameters": [],
"searchQuery": null,
"successRoutes": [],
"failureRoutes": [],
"conditionalSuccessRoutes": [],
"conditionalFailureRoutes": [],
"parameters": [],
"snippets": [
{
"id": 338,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T15:54:59.242Z",
"updatedAt": "2021-02-18T15:54:59.242Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowmecyphersnippet:RxnzcDBqIc1klDTfMWzW6K6cXeJpgbU9tbydfj9amXx9",
"cypher": "RETURN 'THIS IS MY SNIPPET' AS snippetText",
"inputsStr": null,
"outputsStr": null,
"inputs": null,
"outputs": null,
"grnType": "graphgridshowmecyphersnippet",
"label": "GraphGridShowmeCypherSnippet"
}
],
"snippetImpls": null,
"cypherOrder": 0,
"grnType": "graphgridshowmepopulator",
"label": "GraphGridShowmePopulator"
},
"parameters": [],
"empty": false
}

Get Showme

Returns the Showme with the specified path and method (if supplied).

Base URL: /1.0/showme/getShowme/{{showmePath}}?method={{method}}
Method: GET

ParameterDescription
showmePathThe stored path of the Showme or the Showme's grn.
methodThe stored method of the Showme. Note: If multiple Showmes exist with the same path differing only by method, method will be required.

Request

curl --location --request GET "${API_BASE}/1.0/showme/getShowme/create-user?method=POST" \
--header "Authorization: Bearer ${BEARER_TOKEN}"

Response

{
"showme": {
"id": 19,
"labels": [],
"enver": 0,
"createdAt": "2021-02-17T17:54:10.173Z",
"updatedAt": "2021-02-18T15:55:49.04Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowme:31k5yAtzKf5bGmxp2Oi59f2IepNiD7vfssCGJVATdmiu",
"key": "POST /create-user",
"method": "POST",
"path": "/create-user",
"definition": "showmeThatUsesSnippet",
"displayValue": "showmeThatUsesSnippet",
"order": null,
"disableUserRoleRequirement": null,
"nodeTypes": [],
"showmePopulator": null,
"securityRules": null,
"grnType": "graphgridshowme",
"label": "GraphGridShowme"
},
"populator": {
"id": 18,
"labels": [],
"enver": 0,
"createdAt": "2021-02-17T17:54:10.137Z",
"updatedAt": "2021-02-18T17:03:29.764Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowmepopulator:8f2l92UbKm4cnS0FgIKPQY9RQMyOjLWeHLvhDilgj2H3",
"cypher": "$$snippet0",
"displayValue": "showmeThatUsesSnippet",
"definition": "showmeThatUsesSnippet ",
"requiredParameters": [],
"searchQuery": null,
"successRoutes": [],
"failureRoutes": [],
"conditionalSuccessRoutes": [],
"conditionalFailureRoutes": [],
"parameters": [],
"snippets": [
{
"id": 338,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T15:54:59.242Z",
"updatedAt": "2021-02-18T15:54:59.242Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowmecyphersnippet:RxnzcDBqIc1klDTfMWzW6K6cXeJpgbU9tbydfj9amXx9",
"cypher": "RETURN 'THIS IS MY SNIPPET' AS snippetText",
"inputsStr": null,
"outputsStr": null,
"inputs": null,
"outputs": null,
"grnType": "graphgridshowmecyphersnippet",
"label": "GraphGridShowmeCypherSnippet"
}
],
"snippetImpls": null,
"cypherOrder": 0,
"grnType": "graphgridshowmepopulator",
"label": "GraphGridShowmePopulator"
},
"parameters": [],
"empty": false
}

Delete Showme

Deletes the Showme with the specified path and method (if supplied).

Base URL: /1.0/showme/deleteShowme/{{showmePath}}?method={{method}}
Method: Delete

ParameterDescription
showmePathThe stored path of the Showme or the Showme's grn.
methodThe stored method of the Showme. Note: If multiple Showmes exist with the same path differing only by method, method will be required.

Request

curl --location --request DELETE "${API_BASE}/1.0/showme/deleteShowme/create-user?method=POST" \
--header "Authorization: Bearer ${BEARER_TOKEN}"

Response

200 OK

Showme Request Objects

Create Showme Request

A JSON document that defines all necessary and some optional aspects of a new Showme.

ParameterDescription
cypher stringThe Geequel statement to be executed by the Showme. Optional if snippetMap is included and overrideCypherOrder = true Otherwise required.
showmeMethod stringRequired The HTTP method of the Showme (e.g., GET, POST, etc.)
showmePath stringRequired A unique path for the Showme (e.g. /movies/topten or /getAllMovies)
showmeDisplayValue stringRequired A display text for the Showme.
showmeDefinition stringRequired A summary definition for the purpose of the Showme.
showmePopulatorDisplayValue string`Required A display text for the Showme's populator.
showmePopulatorDefinition stringRequired A summary definition for the purpose of the Showme's populator.
nodeTypeGrns List< string >Required (But can be an empty list) A list of grns of NodeTypes from the graph.
params Map< string, object >Required (But can be an empty object) If any params have reasonable defaults, they can be mapped using this field. See [params]((/api/manager/showme#parameters-create-only)
showmeSecurityRules objectRequired An object containing a spel expresion and/or Geequel query for access management. See [SecurityRules]((/api/manager/showme#showmesecurityrules)
snippetMap List< string >List of existing snippet grns. Must be provided in the order in which they are intended to be chained. See [Snippets]((/api/manager/showme#snippets)
cypherOrder integerRequired if Geequel and snippetMap are both provided and overrideCypherOrder is not provided or is false. Where within the snippetMap the explicit Showme Geequel should be inserted. Zero-based. See [Cypher Not Included In SnippetMap]((/api/manager/showme#validation-errors-on-create)
overrideCypherOrder booleanRequired if Geequel and snippetMap are both provided and cypherOrder is not provided. Whether or not to override the explicit Geequel with the snippet map (i.e., if overrideCypherOrder is true, the explicit Geequel will not be used). See [Geequel Not Included In SnippetMap]((/api/manager/showme#validation-errors-on-create) Default: false
snippetImpls List< object >A list of SnippetImplRequest objects for mapping Snippets with input/output maps.
OverrideSnippetImpls booleanIf an empty or null snippetImpl list is provided and overrideSnippetImpls is true, existing snippetImpls will be removed. See [Override SnippetImpls]((/api/manager/showme#override-snippetimpls).
disableUserRoleRequirement booleanSet to true to disable user role requirement for showme endpoint. Showme will still require authentication with CLIENT_INTERNAL,CLIENT_FREE, or CLIENT_USER roles. Depending on configuration, this may be achievable with

SnippetImpl Request

A JSON document that defines all necessary and some optional aspects of a SnippetImpl for Showme creation/update.

ParameterDescription
snippetGrn stringRequired The grn of the existing Snippet for which the SnippetImpl is being created.
inputMap Map< string, string >A Map with string keys and string values where the key is the mapped input from the snippet and the value is the desired end result (e.g., if the snippet is MATCH ($$n:NodeLabel) and the desired end result is MATCH (node:NodeLabel) the inputMap would be: {"n": "node"} See Snippets with Mappings
outputMap Map< string, string >A Map with string keys and string values where the key is the mapped output from the snippet and the value is the desired end result (e.g., if the snippet is RETURN $$n and the desired end result is RETURN node the outputMap would be: {"n": "node"} See Snippets with Mappings
grn stringThe grn of an existing snippetImpl (used for update).

Update Showme Request

A JSON document that defines all necessary and some optional aspects of a new Showme.

ParameterDescription
cypher stringThe Geequel statement to be executed by the Showme.
showmeMethod stringThe HTTP method of the Showme (e.g., GET, POST, etc.)
showmePath stringA unique path for the Showme (e.g. /movies/topten or /getAllMovies)
showmeDisplayValue stringA display text for the Showme.
showmeDefinition stringA summary definition for the purpose of the Showme.
showmePopulatorDisplayValue stringA display text for the Showme's populator.
showmePopulatorDefinition stringA summary definition for the purpose of the Showme's populator.
addParams Map< string,object >**Required (can be an empty map) If update is used for create, all params should be added to addParams. If updating, only new params need to be added. Used for setting reasonable defaults for params. See Add Params.
removeParams List< string >Removes any previous defaults set for the indicated parameters. See Remove Params.
requiredParams List< string >A list of dot notated required parameters that, if missing, will force a validation error before any attempt to execute Geequel. If provided, will overwrite existing required params with the provided list. See Required Params.
showmeSecurityRules objectAn object containing a spel expresion and/or Geequel query for access management. See SecurityRules
snippetMap List< string >List of existing snippet grns. Must be provided in the order in which they are intended to be chained. See Snippets
cypherOrder integerRequired if Geequel and snippetMap are both provided and overrideCypherOrder is not provided or is false. Where within the snippetMap the explicit Showme Geequel should be inserted. Zero-based. See Geequel Not Included In SnippetMap
overrideCypherOrder booleanRequired if Geequel and snippetMap are both provided and cypherOrder is not provided.</br Whether or not to override the explicit Geequel with the snippet map (i.e., if overrideCypherOrder is true, the explicit Geequel will not be used). See Geequel Not Included In SnippetMap Default: false
snippetImpls List< object >A list of SnippetImplRequest objects for mapping Snippets with input/output maps.
overrideSnippetImpls booleanIf an empty or null snippetImpl list is provided and overrideSnippetImpls is true, existing snippetImpls will be removed. See Override SnippetImpls.

SecurityRules Request

A JSON document that defines optional security rules for a Showme. See SecurityRules.

ParameterDescription
cypherQuery stringThe Geequel statement to be executed previous to the Showme to determine whether or not access should be granted. Must return a truthy value.
spelExpression stringA Spring Expression Language expression to be checked against to determine whether or not access should be granted

Snippet API

Get Status

Used to check the health of the Snippet service. Will return a 200 OK response if healthy.

Base URL: /1.0/manager/snippet/status
Method: GET

Request

curl --location --request GET -i "${API_BASE}/1.0/manager/snippet/status" \
--header "Authorization: Bearer ${BEARER_TOKEN}"

Create Snippet

Creates a new Snippet.

Base URL: /1.0/manager/snippet
Method: POST

Request

curl --location --request POST "${API_BASE}/1.0/manager/snippet" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"cypher": "RETURN '\''THIS IS MY SNIPPET'\'' AS snippetText",
"inputs": {
},
"outputs": {
}
}'

Response

{
"id": 342,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T17:25:59.7Z",
"updatedAt": "2021-02-18T17:25:59.7Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowmecyphersnippet:D1Y1i3aWW5E0ksx6dDcGXDOs8eQVfiEFGyRTLFH7Ey0l",
"cypher": "RETURN 'THIS IS MY SNIPPET' AS snippetText",
"inputsStr": null,
"outputsStr": null,
"inputs": null,
"outputs": null,
"grnType": "graphgridshowmecyphersnippet",
"label": "GraphGridShowmeCypherSnippet"
}

Update Snippet

Updates an existing snippet's Geequel, inputs, and/or outputs. Note: if inputs/outputs are sent as null, they will be ignored, otherwise they will overwrite existing values. Passing in an empty map will remove all existing values.

Base URL: /1.0/manager/snippet/{{grn}}
Method: PUT

ParameterDescription
grnThe grn of the Snippet to be updated

Request

curl --location --request PUT "${API_BASE}/1.0/manager/snippet" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"cypher": "RETURN '\''THIS IS MY UPDATED SNIPPET'\'' AS snippetText",
"inputs": {
},
"outputs": {
}
}'

Response

{
"id": 360,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T20:33:55.314Z",
"updatedAt": "2021-02-18T20:33:55.314Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowmecyphersnippet:2HmWWz6vCJNXiF15EYw20lvlECXlI3e4gYsyfAHr5W7n",
"cypher": "RETURN 'THIS IS MY UPDATED SNIPPET' AS snippetText",
"inputsStr": null,
"outputsStr": null,
"inputs": null,
"outputs": null,
"grnType": "graphgridshowmecyphersnippet",
"label": "GraphGridShowmeCypherSnippet"
}

GET Snippet

Returns the Snippet with the specified grn.

Base URL: /1.0/manager/snippet/{{grn}}
Method: GET

ParameterDescription
grnThe grn of the Snippet to be returned

Request

curl --location --request GET "${API_BASE}/1.0/manager/snippet/grn:gg:graphgridshowmecyphersnippet:2HmWWz6vCJNXiF15EYw20lvlECXlI3e4gYsyfAHr5W7n" \
--header "Authorization: Bearer ${BEARER_TOKEN}"

Response

{
"id": 360,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T20:33:55.314Z",
"updatedAt": "2021-02-18T20:33:55.314Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowmecyphersnippet:2HmWWz6vCJNXiF15EYw20lvlECXlI3e4gYsyfAHr5W7n",
"cypher": "RETURN 'THIS IS MY UPDATED SNIPPET' AS snippetText",
"inputsStr": null,
"outputsStr": null,
"inputs": null,
"outputs": null,
"grnType": "graphgridshowmecyphersnippet",
"label": "GraphGridShowmeCypherSnippet"
}

Delete Snippet

Deletes an existing Snippet.

note

Deletion does not check for existing usage. It is recommended to edit any Showmes to remove snippet usage before deleting or the related Showmes will potentially fail on execution.

Base URL: /1.0/manager/snippet/{{grn}}
Method: DELETE

Request

curl --location --request DELETE "${API_BASE}/1.0/manager/snippet/grn:gg:graphgridshowmecyphersnippet:2HmWWz6vCJNXiF15EYw20lvlECXlI3e4gYsyfAHr5W7n" \
--header "Authorization: Bearer ${BEARER_TOKEN}"

Response

200 OK

Create/Update Snippet Objects

ParameterDescription
cypher stringThe Geequel statement to be stored by the Snippet. May optionally include inputs (designated by $$[name] and mapped in the inputs map to their respective types) or outputs (designated by $$[name] and mapped in the outputs map to their respective types) Required on create
inputs Map< string, string >A map of the inputs expected and/or allowed by the snippet to their types. See Snippets with mappings.
outputs Map< string, string >A map of the outputs returned by the snippet to their types. See Snippets with mappings.

Route API

Get Status

Used to check the health of the Route service. Will return a 200 OK response if healthy.

Base URL: /1.0/manager/route/status
Method: GET

curl --location --request GET "${API_BASE}/1.0/manager/route/status" \
--header "Authorization: Bearer ${BEARER_TOKEN}"

Create/Update Route Request

Creates a new Route or updates an existing Route.

Base URL: /1.0/manager/route/updateRoute?name={{name}}
Method: PUT

Request

curl --location --request PUT "${API_BASE}/1.0/manager/route/updateRoute?name=route" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"url": "localhost/1.0/showme/getShowme/create-user",
"method": "POST"
}'

If connecting to an outside API with its own oauth tokens, you can use RouteAuthorization and RouteHeaders nodes to generate an outside API token and craft your request as well. "Errors" means that when a request gets an error of the specified type (401 Unauthorized in this case) then the routeErrors will kick off the appointed request (route authorization in this case, which will get a token and then re-try the initial route). Examples below.

Create/Update Route Request - Using outside API with static access token

{
"url":"https://my.outside.api.com/api/request",
"method" : "POST",
"headers": [{
"key": "Authorization"
"value":"Bearer {accessToken}"
}]
}

Create/Update Route Request - Using outside API with static client/secret

{
"url":"https://my.outside.api.com/api/request",
"method" : "POST",
"authorization": {
"grn": "{{routeAuthorizationGrn}}"
"url":"https://my.outside.api.com/api/token",
"params":[
{
"key":"username",
"value":"myUsername"
},
{
"key":"password",
"value":"myPassword"
},
{
"key":"grant_type",
"value":"password"
}
],
"headers":[
{
"key":"Authorization",
"value":"Basic abcdefghijklmnopqrstuvwxyz"
},
{
"key":"Content-Type",
"value":"application/x-www-form-urlencoded"
}
]
},
"errors":[
{
"authorization": {
"grn": "{{routeAuthorizationGrn}}"
},
"status":"401"
}
]
}

Create/Update Route Request - Using outside API with generated client/secret

{
"url": "https://my.outside.api.com/api/request",
"method": "POST",
"authorization": {
"grn": "{{routeAuthorizationGrn}}",
"url": "https://my.outside.api.com/api/token",
"params": [{
"key": "username",
"value": "68209"
},
{
"key": "password",
"value": "xxxxxx/xxxxxxxxxx/xxxxx/xxxxxxxxxx"
},
{
"key": "grant_type",
"value": "password"
}
],
"headers": [{
"key": "Authorization",
"cryptographyBuilder": {
"clientId": {},
"secret": {
"generators": [{
"chars": 32,
"order": 0,
"letters": "abcdefghijklmnop"
}],
"transformations": [{
"displayValue": "base64",
"order": 2,
"value": "thisIsWhatIWantBase64d"
}]
}
}
},
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded"
}
]
},
"errors": [{
"authorization": {
"grn": "{{routeAuthorizationGrn}}"
},
"status": "401"
}]
}

On execute, to fill in clientId and staticValue params, we add authParams to the body:

"authParams": {
"username": {
"encryption": {
"staticValues": [
{
"displayValue": "myUsername",
"order": 0
}
]
}
},
"password": {
"encryption": {
"staticValues": [
{
"displayValue": "myPassword",
"order": 0
}
]
}
}
}

Get Route

Returns the Route with the specified name.

Base URL: /1.0/manager/route/{{name}}
Method: GET

ParameterDescription
grnThe grn of the Route to be returned

Request

curl --location --request GET "${API_BASE}/1.0/manager/route/getRoute?name=route" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"

Response

{
"id": 305,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T21:45:07.181Z",
"updatedAt": "2021-02-18T21:45:07.181Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:route:F5U5A5QxRiDKr5tjim4lhMXleT0hKsOLom1J8XOblIQK",
"url": "localhost/1.0/showme/getShowme/create-user",
"method": "GET",
"body": null,
"name": "route",
"key": null,
"showmes": null,
"order": null,
"headers": null,
"authorization": null,
"errors": null,
"grnType": "route",
"label": "Route"
}

Execute Route

Executes an existing route by name. Response will vary depending on the target route.

Base URL: /1.0/manager/route/executeRoute?name={{name}}
Method: POST

Request

curl --location --request POST "${API_BASE}/1.0/manager/route/executeRoute?name=route" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"

Response

{
"httpStatus": "OK",
"body": {
"populator": {
"id": 358,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T17:40:35.303Z",
"updatedAt": "2021-02-18T17:40:35.364Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowmepopulator:gJgWBTcjp2K9zNZZbMdv8rqGl7Vbb3WwsJgVH7SGZ1mD",
"cypher": "MERGE (u:User {grn:{grn}}) SET u.username = {name}, u.mock = true",
"displayValue": "create-user",
"definition": "create-user",
"requiredParameters": [],
"searchQuery": null,
"successRoutes": [],
"failureRoutes": [],
"conditionalSuccessRoutes": [],
"conditionalFailureRoutes": [],
"parameters": [],
"snippets": null,
"snippetImpls": null,
"cypherOrder": 0,
"grnType": "graphgridshowmepopulator",
"label": "GraphGridShowmePopulator"
},
"parameters": [],
"showme": {
"id": 359,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T17:40:35.329Z",
"updatedAt": "2021-02-18T17:40:35.329Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowme:FacJEeQiJA8xkniwJLVD7WOxcwmhYtASSeEyHlW8jEAk",
"key": "POST /create-user",
"method": "POST",
"path": "/create-user",
"definition": "pAn example showme,
"displayValue": "create-user",
"order": null,
"disableUserRoleRequirement": null,
"nodeTypes": [],
"showmePopulator": null,
"securityRules": null,
"grnType": "graphgridshowme",
"label": "GraphGridShowme"
},
"empty": false
},
"name": "route"
}

Links an existing route by name to a showme by grn. Relationship determines whether it's absolute or conditional.

Base URL:/1.0/manager/route/linkRoute?name={{name}}&showmeGrn={{showmeGrn}}&relationship={{relationship}}
Method: POST

ParameterDescription
nameThe name of the Route to be linked"
showmeGrnThe grn of the Showme to which the Route is to be linked.
relationshipThe determining relationship for whether the route is conditional, success, or failure. Accepted values are: success, conditional-success, conditional-failure, failure. Any other value will be considered a failure route. See Routes Default: failure

Detach Route

Detaches all absolute and conditional connections between the Route with the specified name and the Showme with the specified grn.

Base URL: /1.0/manager/route/detachRoute?name={{name}}&showmeGrn={{showmeGrn}}
Method: POST

ParameterDescription
grnThe grn of the Showme to which the Route is to be detached

Route Request Objects

Create/Update Route Request

A JSON document that defines all necessary and some optional aspects of a new Snippet.

ParameterDescription
url stringRequired The URL of the target route.
method stringThe HTTP method of the target route.
key stringThe key of the boolean returned from the showme results to check against for conditional execution.

Request Sequencer API

Get Status

Used to check the health of the Request Sequencer service. Will return a 200 OK response if healthy.

Base URL: /1.0/manager/requestSequencer/status
Method: GET

curl --location --request GET -i "${API_BASE}/1.0/manager/requestSequencer/status" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \

Create/Update Request Sequencer

Creates a new Request Sequencer or updates an existing Request Sequencer.

Base URL: /1.0/manager/requestSequencer/updateRequestSequencer
Method: POST

Request

curl --location --request POST "${API_BASE}/1.0/manager/requestSequencer/updateRequestSequencer" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"name": "create-user",
"routes": [
{
"grn": "grn:gg:route:3TZW7v2P4cRdBNodgv9B0NNtcQ5fXtTVT9gno6kb0oqZ",
"order": 0
}
],
"showmes": [
{
"grn": "grn:gg:graphgridshowme:5kyAKeten31qtDYrSQsAptDpmEcya8WMZiIkiJZQnXCf",
"order": 1
}
]
}
'

Response

{
"id": 350,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T22:17:37.073Z",
"updatedAt": "2021-02-18T22:17:37.073Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:requestsequencernode:NxyK5mxBvHpn5lvhoTYKR9ycM4aGLQf3zrybaaPrK3ot",
"showmes": [
{
"id": 346,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T17:03:29.745Z",
"updatedAt": "2021-02-18T17:26:57.032Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:graphgridshowme:5kyAKeten31qtDYrSQsAptDpmEcya8WMZiIkiJZQnXCf",
"key": "POST /showmeThatUsesSnippet",
"method": "POST",
"path": "/showmeThatUsesSnippet",
"definition": "An example showme",
"displayValue": "create-user",
"order": 1,
"disableUserRoleRequirement": null,
"nodeTypes": [],
"showmePopulator": null,
"securityRules": null,
"grnType": "graphgridshowme",
"label": "GraphGridShowme"
}
],
"routes": [
{
"id": 351,
"labels": [],
"enver": 0,
"createdAt": "2021-02-18T22:17:37.073Z",
"updatedAt": "2021-02-18T22:17:37.073Z",
"createdBy": "graphgrid",
"lastModifiedBy": "graphgrid",
"grn": "grn:gg:route:3TZW7v2P4cRdBNodgv9B0NNtcQ5fXtTVT9gno6kb0oqZ",
"url": null,
"method": null,
"body": null,
"name": null,
"key": null,
"showmes": null,
"order": 0,
"headers": null,
"authorization": null,
"errors": null,
"grnType": "route",
"label": "Route"
}
],
"name": "create-user",
"grnType": "requestsequencernode",
"label": "RequestSequencer"
}

Execute Request Sequencer

Executes an existing request sequencer by name. Response will vary depending on the target routes/showmes. Whatever body is passed in will be entered as the parameters for request 0, the results will be aggregated with the original body to request 1, and all of the results will be compiled and passed in in that manner until the last function has run, and finally will display to the user the total of all the responses.

Base URL: /1.0/manager/requestSequencer/executeRequestSequencer/{{name}}
Method: POST

Create/Update Request Sequencer Request With URL Params

tip

urlParams is a special parameter for if there are any URL parameters in the request.

On route creation:

"url":"https://my.api.com/api/{{urlParamName}}/endpoint"

On execution:

{
"urlParams": {
"urlParamName": "thisIsMyUrlParamValue"
}
}
tip

includedFields and excludedFields are special parameters. If includedFields is passed in, only the indicated properties will be returned. If excludedFields is entered, all BUT the indicated properties will be returned. Example:

Include Request

"includedFields":{
"name":{
"grn":true
}
}