sys.login
returns a metadata field, useful for alternative login methods which need to give the user some data upon login
user.list
return value elements include a new fieldcreatedAt
with a timestamp of user creation
user.rename
*.count
methodssync.list
topic.list
depth
andfilter
parameters for*.list
methods
user.getEffectiveTags
user.setPass
doesn't require any permission when changing the user's own password.
pipe.write
now accepts amulti
boolean parameter.
- Bump version to align numbers with server/clients.
sys.reload
is back to reload a connection's own session without permissions
user.getTags
user.setDisabled
sys.login
also returns the current tags of the user
user.addWhitelist
user.delWhitelist
user.addBlacklist
user.delBlacklist
user.setMaxSessions
sys.version
- New error code
-32006 - ErrLockNotOwned
available for the Sync operations
sys.node.list
return value now includes the api version (check sys.node.list)task.list
returns value improved (check task.list)sys.session.list
fieldid
renamed toconnid
sys.session.kick
fieldconnId
renamed toconnid
sys.session.reload
fieldconnId
renamed toconnid
sys.watchdog
parameter made optional, and put into a mapsync.lock
andsync.unlock
return error-32006
on unsuccessful lock/unlock instead of"ok":false
sys.ping
returns an"ok": true
on success
user.listTemplate
sys.reload
- Initial specification
Any Nexus response which has no error but its result would be empty, has an
{ "ok": true }
instead
ErrParse = -32700
ErrInvalidRequest = -32600
ErrInternal = -32603
ErrInvalidParams = -32602
ErrMethodNotFound = -32601
ErrTtlExpired = -32011
ErrPermissionDenied = -32010
ErrLockNotOwned = -32006
ErrUserExists = -32005
ErrInvalidUser = -32004
ErrInvalidPipe = -32003
ErrInvalidTask = -32002
ErrCancel = -32001
ErrTimeout = -32000
ErrNoError = 0
Any API call can fail and return with an error instead of the documented result value, but these have been ommited below since error codes are self-explanatory.
Test the connection or generate some traffic to keep the connection alive.
null
"result": { "ok": true }
Returns the semantic version of the node.
null
"result": { "version": "0.2.0" }
Configure the time the connection will be considered alive without traffic.
"watchdog": <Number>
- Optional - Sets the number of seconds the watchdog will hold. If not set, the result will show the current value.
"result": { "watchdog": 10 }
Switches the user working with the current connection.
"method": <string>
- Optional - Specifies the login method. If omitted, defaults to "basic".
If auth method is basic:
"user": <string>
- User to login as"pass": <string>
- User's password
Else, the specified method should document which fields its expecting
"result": { "ok": true, "connid": <string>, "user": <string>, "tags": <Object>, "metadata": <Object>}
List the nexus nodes connected to the cluster. Includes some info about connected clients, CPU load and nexus version for each node.
"limit": <Number>
- Optional - Limit the number of results. Defaults to 100"skip": <Number>
- Optional - Skips a number of results. Defaults to 0
"result": [ {"id": <string>, "version": <String>, "clients": <Number>, "load": {"load1": <Number>, "load5": <Number>, "load15": <Number>}}, ... ]
List the active sessions for an user prefix on the cluster.
"prefix": <String>
- Username prefix to list from"depth": <Number>
- Optional - Filter the sessions listed to the passed depth relative to the passed prefix. Defaults to -1 (no filtering)"filter": <String>
- Optional - Filter the sessions by user based on the passed RE2 regexp"limit": <Number>
- Optional - Limit the number of results. Defaults to 100"skip": <Number>
- Optional - Skips a number of results. Defaults to 0
"result": [{"sessions":[{"creationTime":"2016-08-30T12:39:16.39Z","connid":"687c3b7baf4b9471","nodeid":"687c3b7b","protocol":"tcp","remoteAddress":"172.17.0.1:51398"},{"creationTime":"2016-08-30T12:39:21.283Z","id":"687c3b7b407bcce2","nodeid":"687c3b7b","protocol":"tcp","remoteAddress":"172.17.0.1:51402"}],"user":"root","n":2}, ...]
Count the active sessions for an user prefix on the cluster.
"prefix": <String>
- Username prefix to count from"filter": <String>
- Optional - Filter the sessions by user based on the passed RE2 regexp"subprefixes": <Boolean>
- Optional - Return a detailed count for each subprefix. Defaults to false
"result": {"count": 55}
"result": [{"prefix": "root", "count": 12}, {"prefix": "root.sub1", "count": "10"}, {"prefix": "root.sub2", "count": 2}]
Terminates any connection which session id matches the prefix.
When sys.session.kick call returns the session is still not kicked. The action will be completed when the node that owns the session captures and executes the request (this is usually done in milliseconds).
"connid": <String>
- Connection ID prefix
"result": { "kicked": 7 }
Reloads user data for any connection which connection id matches the prefix
When sys.session.reload call returns the session is still not reloaded. The action will be completed when the node that owns the session captures and executes the request (this is usually done in milliseconds).
"connid": <String>
- Connection ID prefix
"result": { "reloaded": 2 }
Creates a new pipe.
"len": <Number>
- Optional - Maximum capacity of the pipe. Defaults to 1000
"result": { "pipeid": <string> }
Closes a pipe
"pipeid": <String>
- PipeID of the pipe to close
"result": { "ok": true }
Writes any JSON object into a pipe.
"pipeid": <String>
- PipeID of the pipe to write to"msg": <Object>
- Data to write to the pipe"multi": <Boolean>
- If true,"msg"
must be an Array, and items will be sent one by one through the pipe.
"result": { "ok": true }
Reads a JSON object from a pipe. Blocks until an element is available on the pipe or exceeds the timeout
"pipeid": <String>
- PipeID of the pipe to write to"max": <Number>
- Maximum number of elements to read from the pipe"timeout": <Number>
- Maximum number of second to wait for a read to happen. Defaults to blocking forever
{ "waiting": <Number>, "drops": <Number>, "msgs": [{ "msg": <Object>, "count": <Number> }, ...] }
waiting
: Number of messages still in the pipedrops
: Number of messages which could not be read on time, did not fit on the pipe and were lost.msgs
: Array of objects containing the data written to the pipe and a secuential identifier
Grabs a lock, cluster-wide.
"lock": <String>
- Name of the lock to grab
"result": { "ok": true }
Frees a lock, cluster-wide.
"lock": <String>
- Name of the lock to grab
"result": { "ok": true }
List the active locks for a prefix on the cluster.
"prefix": <String>
- Lock prefix to list from"depth": <Number>
- Optional - Filter the locks listed to the passed depth relative to the passed prefix. Defaults to -1 (no filtering)"filter": <String>
- Optional - Filter the locks by prefix based on the passed RE2 regexp"limit": <Number>
- Optional - Limit the number of results. Defaults to 100"skip": <Number>
- Optional - Skips a number of results. Defaults to 0
"result": [{"id": "lock.1", "owner": "root"}, {"id": "lock.2", "owner": "test"}]
Count the active locks for a prefix on the cluster.
"prefix": <String>
- Prefix to count from"filter": <String>
- Optional - Filter the locks by prefix based on the passed RE2 regexp"subprefixes": <Boolean>
- Optional - Return a detailed count for each subprefix. Defaults to false
"result": {"count": 55}
"result": [{"prefix": "root", "count": 12}, {"prefix": "root.sub1", "count": "10"}, {"prefix": "root.sub2", "count": 2}]
Calls a method which will be resolved by the system, and will return a result or an error (examples on the result section)
"method": <String>
- Which method is this task invoking"params": <Object>
- Method parameters"detach": <Bool>
- The task will eventually be processed but we do not care about the result"prio": <Number>
- Sets the priority of this task among other pushes on the same method"ttl": <Number>
- How many times this task can be requeued (by a failed worker/node or a task reject)"timeout": <Number>
- How many seconds should a task be on any state other than "done" before the task is considered failed.
If "detach" is true, it will immediately receive:
"result": { "ok": true }
Otherwise, it will get an answer defined by the worker who pulls the task:
"result": { "answer": 42 }
or
"error": {"code":123,"message":"asdf","data":""}
Pulls a task from a path to work on
"prefix": <String>
- Prefix to pull tasks from"timeout": <Number>
- How much time should we wait for a task to get pulled
"result": {"detach":false,"method":"test","params":{},"path":"asdf.","prio":0,"tags":{"@admin":true},"taskid":"687c3b7b966f55e92d376e4b6a6da37f9c8d","user":"root"}
Mark a task as finished successfully, and set the task result parameter
"taskid": <String>
- Task being resolved"result": <Object>
- Data delivered to the pusher as "result"
"result": { "ok": true }
Mark a task as finished with an error, and set the error fields
"taskid": <String>
- Task being resolved with an error"code": <Number>
- Optional - Error code"message": <String>
- Optional - Error message"data": <Object>
- Optional - Error data
"result": { "ok": true }
Reject a pulled task. It will be marked as waiting, and available to be pulled again. Decrements the task's TTL
"taskid": <String>
- Task being rejected
"result": { "ok": true }
Cancel a task, which will mark it as cancelled and wake up whoever was waiting for its completion
"taskid": <String>
- Task being cancelled
"result": { "ok": true }
List tasks happening inside a prefix and its properties
"prefix": <String>
- Path prefix"depth": <Number>
- Optional - Filter the tasks listed to the passed depth relative to the passed prefix. Defaults to -1 (no filtering)"filter": <String>
- Optional - Filter the tasks by prefix based on the passed RE2 regexp"limit": <Number>
- Optional - Limit the number of results. Defaults to 100"skip": <Number>
- Optional - Skips a number of results. Defaults to 0
"result": [{"id":"687c3b7bfbcdae7cb774d215cf923252f3fb","state":"waiting","path":"test.","priority":0,"ttl":0,"detached":false,"user":"root","method":"","params":null,"targetSession":"","result":null,"errCode":null,"errString":"","errObject":null,"tags":null,"creationTime":"2016-08-31T09:44:16.316Z","deadline":"2016-08-31T09:45:16.316Z"}, ...]
Count the active tasks (with push and pull count) for a prefix on the cluster.
"prefix": <String>
- Prefix to count from"filter": <String>
- Optional - Filter the tasks by prefix based on the passed RE2 regexp"subprefixes": <Boolean>
- Optional - Return a detailed count for each subprefix. Defaults to false
"result": {"count": 55, "pushCount": 25, "pullCount": 30}
"result": [{"prefix": "root", "count": 12, "pushCount": 6, "pullCount": 6}, {"prefix": "root.sub1", "count": "10", "pushCount": 2, "pullCount": 8}, {"prefix": "root.sub2", "count": 2, "pushCount": 0, "pullCount": 2}]
Subscribe a pipe to a topic. Everything published on the topic will be written on the pipe
"pipeid": <String>
- PipeID to subscribe"topic": <String>
- Topic to subscribe the pipe to
"result": { "ok": true }
Unsubscribe a pipe from a topic.
"pipeid": <String>
- PipeID to subscribe"topic": <String>
- Topic to unsubscribe the pipe from
"result": { "ok": true }
Publish data to a topic.
"topic": <String>
- Topic to send the data to"msg": <Object>
- Data to send
"result": { "ok": true }
List the active topic subscriptions for a prefix on the cluster.
"prefix": <String>
- Topic prefix to list from"depth": <Number>
- Optional - Filter the topics listed to the passed depth relative to the passed prefix. Defaults to -1 (no filtering)"filter": <String>
- Optional - Filter the topics by prefix based on the passed RE2 regexp"limit": <Number>
- Optional - Limit the number of results. Defaults to 100"skip": <Number>
- Optional - Skips a number of results. Defaults to 0
"result": [{"topic": "some.topic", "subscribers": 3}, {"topic": "some.other.topic", "subscribers": 5}]
Count the active topic subscriptions for a topic prefix on the cluster.
"prefix": <String>
- Topic prefix to count from"filter": <String>
- Optional - Filter the topics by prefix based on the passed RE2 regexp"subprefixes": <Boolean>
- Optional - Return a detailed count for each subprefix. Defaults to false
"result": {"count": 55}
"result": [{"prefix": "root", "count": 12}, {"prefix": "root.sub1", "count": "10"}, {"prefix": "root.sub2", "count": 2}]
Create a new user which will be able to authenticate by basic auth
"user": <String>
- Username of the new user"pass": <String>
- Password of the new user
"result": { "ok": true }
Delete an existent user
"user": <String>
- Username of the user to delete
"result": { "ok": true }
Change the username of a user
"user": <String>
- Username of the user"new": <String>
- New username
"result": { "ok": true }
Lists users which username starts with a prefix
"prefix": <String>
- Prefix where the tags will take effect"depth": <Number>
- Optional - Filter the users listed to the passed depth relative to the passed prefix. Defaults to -1 (no filtering)"filter": <String>
- Optional - Filter the users by prefix based on the passed RE2 regexp"limit": <Number>
- Optional - Limit the number of results. Defaults to 100"skip": <Number>
- Optional - Skips a number of results. Defaults to 0
"result": [{"blacklist":["172.17.*"],"maxsessions":42,"tags":{test":{"@admin":true}},"templates":["template1","auth-token"],"user":"test","whitelist":["172.17.0.1"],"createdAt":"2016-08-31T09:45:16.316Z"}]
Count the users on a prefix on the cluster.
"prefix": <String>
- Username prefix to count from"filter": <String>
- Optional - Filter the users by prefix based on the passed RE2 regexp"subprefixes": <Boolean>
- Optional - Return a detailed count for each subprefix. Defaults to false
"result": {"count": 55}
"result": [{"prefix": "root", "count": 12}, {"prefix": "root.sub1", "count": "10"}, {"prefix": "root.sub2", "count": 2}]
Set a tag on an user on a prefix
"user": <String>
- Username of the user to set tags on"prefix": <String>
- Prefix where the tags will take effect"tags": <Object>
- Tags to be set
"result": { "ok": true }
Remove a tag from an user on a prefix
"user": <String>
- Username of the user to remove tags from"prefix": <String>
- Prefix where the tags will take effect"tags": <Object>
- Tags to be deleted
"result": { "ok": true }
Return the list of tags result from merging the user tags with the tags being inherited by the templates
"user": <String>
- Username of the user to get the tags from
"result": { "tags": { "test": { "@task.pull": true, "@task.push": true }}}
Return the list of effective tags for a prefix (result from merging the user tags with the tags being inherited by the templates)
"user": <String>
- Username of the user to get the tags from"prefix": <String>
- Prefix to compute and return the user effective tags
"result": { "tags": { "@task.pull": true, "@task.push": true }}
Set the user password for basic auth (setting user's own password doesn't need any permission)
"user": <String>
- Username of the user"pass": <String>
- New password
"result": { "ok": true }
Add a template to an user
"user": <String>
- Username"template": <String>
- Template to add
"result": { "ok": true }
Remove a template from an user
"user": <String>
- Username"template": <String>
- Template to remove
"result": { "ok": true }
Add an address to an user whitelist
"user": <String>
- Username"ip": <String>
- IP address. Accepts regular expressions (192.168.*)
"result": { "ok": true }
Remove an address to an user whitelist
"user": <String>
- Username of the user"ip": <String>
- IP address. Accepts regular expressions (192.168.*)
"result": { "ok": true }
Add an address to an user blacklist
"user": <String>
- Username of the user"ip": <String>
- IP address. Accepts regular expressions (192.168.*)
"result": { "ok": true }
Remove an address to an user blacklist
"user": <String>
- Username of the user"ip": <String>
- IP address. Accepts regular expressions (192.168.*)
"result": { "ok": true }
Set the maximum number of parallel sessions active of an user
"user": <String>
- Username of the user"maxsessions": <Number>
- Number of maximum sessions
"result": { "ok": true }
A disabled user cannot login
"user": <String>
- Username of the user"disabled": <Bool>
- Enable/Disable the login
"result": { "ok": true }