Skip to content

RexConnect Commands

Zach Kinstner edited this page Sep 3, 2013 · 6 revisions

Written for version 0.5.0. Notes:

  • All RexConnect commands and arguments are case-sensitive.
  • For simplicity, command examples below are shown without the required request wrapper.

Commands

RexConnect supports the following commands:

Query

The query command executes a Gremlin script (with optional parameters).

Arguments

The query command supports three arguments:

  • String script (required): The Gremlin script.
  • String params (optional): A parameter map in JSON format. Despite the params JSON formatting, this argument should be written as a string within the overall request/command JSON data.
  • String cacheScript (optional): Use a value of "1" to make RexConnect cache this query's script. A numeric cache key will be provided with the command's response.

Server Example

{
  "cmd": "query",
  "argList": [
    {
      "g.addVertex([TestId:x]);",
      "{\\"x\\": 123}",
      "1"
    }
  ]
}

Console Example

# RexConnect> query
#   ...script (0; string): g.addVertex([TestId:x]);
#   ...params (1; string; opt): {"x":123}
#   ...cacheScript (2; string; opt): 1

{"t":11,"k":99,"r":[{"_properties":{"TestId":123},"_id":"194844","_type":"vertex"}]}

 

QueryC

The queryc command executes a cached script (with optional parameters).

Arguments

The queryc command supports two arguments:

  • String cacheKey (required): The numeric key that identifies the cached script.
  • String params (optional): A parameter map in JSON format. Despite the params JSON formatting, this argument should be written as a string within the overall request/command JSON data.

Server/Extension Example

{
  "cmd": "queryc",
  "argList": [
    {
      "99",
      "{\\"x\\": 123}"
    }
  ]
}

Console Example

# RexConnect> queryc
#   ...cacheKey (0; string): 99
#   ...params (1; string; opt): {"x":123}

{"t":11,"r":[{"_properties":{"TestId":123},"_id":"194844","_type":"vertex"}]}

 

Session

The session command performs actions related to RexPro sessions and session state. While a session is started/active, RexPro remembers that session's variables across independent requests/commands. Opened sessions should always closed.

A session also represents an open-ended transaction. Thus, all changes made will be lost upon close unless commit is called.

Arguments

The session command supports one argument, "action".

  • String action (required): The session-related action to perform. Accepted actions:
    • start opens a new session.
    • close kills the current session.
    • commit saves the changes made during the session.
    • rollback reverts the changes made during the session.

Server/Extension Example

{
  "cmd": "session",
  "argList": [
    {
      "start"
    }
  ]
}

Console Example

# RexConnect> session
#   ...action (0; string): start

{"timer":4,"results":["41f2336a-3f22-4de2-bd25-0378b84ab6ab"]}

 

Config

The config command alters the default RexConnect configuration state for a particular request. Note that these configuration changes are not persisted across requests.

Arguments

The config command supports two arguments, "setting" and "mode".

  • String setting (required): The configuration setting to change. Accepted settings:
    • pretty specifies whether the returned JSON uses "pretty" formatting. Accepted modes:
      • 0 (default) disabled
      • 1 enabled
    • debug specifies whether to debugging information should be outputted. Accepted modes:
      • 0 (default) disabled
      • 1 enabled
  • int mode (required): The mode value for the specified setting. Accepted modes are displayed above with their corresponding settings.

Server/Extension Example

{
  "cmd": "config",
  "argList": [
    {
      "pretty",
      "1"
    }
  ]
}

Console Example

# RexConnect> config
#   ...setting (0; string): pretty
#   ...mode (1; int): 1

{
    "timer": 0
}

Clone this wiki locally