REST API
Connect to Ignite over HTTP REST protocol.
Ignite provides an HTTP REST client that gives you the ability to communicate with the grid over HTTP and HTTPS protocols using the REST approach. REST APIs can be used to perform different operations like read/write from/to cache, execute tasks, get various metrics, and more.
Getting Started
To enable HTTP connectivity, make sure that the ignite-rest-http
module is in the classpath of your application. With the Ignite binary distribution, this means copying the ignite-rest-http
module from IGNITE_HOME/libs/optional/
to the IGNITE_HOME/libs
folder.
Explicit configuration is not required; the connector starts up automatically and listens on port 8080
. You can check if it works with curl:
curl 'http://localhost:8080/ignite?cmd=version'
Request parameters may be provided as either a part of URL or in a form data:
curl 'http://localhost:8080/ignite?cmd=put&cacheName=myCache' -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d 'key=testKey&val=testValue'
Security
Ignite allows you to establish a secure connection to the cluster via the REST protocol. For this, make sure that authentication is enabled on the cluster via the IgniteConfiguration.setAuthenticationEnabled(true)
method. Note that currently authentication is available only when persistence is enabled.
When authentication is enabled on the server, you can request user authorization by providing ignite.login=[user]&ignite.password=[password]
parameters in the REST connection string. Doing so will provide you with a session token that can be used with any command within that session.
There are two ways to request authorization:
-
Use the authenticate command with ignite.login=[user]&ignite.password=[password] parameters.
https://[host]:[port]/ignite?cmd=authenticate&ignite.login=[user]&ignite.password=[password]
-
Use any REST command with
ignite.login=[user]&ignite.password=[password]
parameters in the path of your connection string. In our example below, we have used theversion
command:http://[host]:[port]/ignite?cmd=version&ignite.login=[user]&ignite.password=[password]
In both of the examples above, replace [host], [port], [user], and [password] values with actual values.
Executing any one of the above strings in a browser will provide a response with a session token which will look something like this:
{"successStatus":0,"error":null,"sessionToken":"EF6013FF590348CE91DEAE9870183BEF","response":true}
Once you obtain the session token, use the sessionToken parameter with your connection string as shown in the example below:
http://[host]:[port]/ignite?cmd=top&sessionToken=[sessionToken]
In the above connection string, replace [host], [port], and [sessionToken] with actual values.
Data Types
The REST API also provides support for Java built-in types for put/get operations via keyType
and valueType
optional parameters. Note that unless one of the below mentioned types are explicitly specified, the REST protocol will exchange the key-value data in String
format. This means that the data will be stored and retrieved to/from the cluster as a String
.
REST KeyType/ValueType | Corresponding Java Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The date value should be in the format as specified in the Example: 2018-01-01 |
|
The time value should be in the format as specified in the Example: 01:01:01 |
|
The timestamp value should be in the format as specified in the Example: 2018-02-18%2001:01:01 |
|
|
|
|
The following example shows a put
command with keyType=int
and valueType=date
:
http://[host]:[port]/ignite?cmd=put&key=1&val=2018-01-01&cacheName=myCache&keyType=int&valueType=date
Similarly, the get
command with keyType=int
and valueType=date
would be:
http://[host]:[port]/ignite?cmd=get&key=1&cacheName=myCache&keyType=int&valueType=date
API Reference
Internally, Ignite uses Jetty server to provide HTTP server features. HTTP REST client is configured via the ConnectorConfiguration
bean.
Returned Value
The HTTP REST request returns a JSON object which has a similar structure for each command:
Name |
Type |
Description |
Example |
|
|
Affinity node ID. |
|
|
|
This field contains description of error if server could not handle the request. |
Specifically for each command. |
|
|
When authentication is enabled on the server, this field contains a session token that can be used with any command within that session. If authentication is off, this field contains |
Otherwise, |
|
|
This field contains the result of the command. |
Specifically for each command. |
|
|
Exit status code. It might have the following values:
|
|
Log
Shows server logs.
http://host:port/ignite?cmd=log&from=10&to=100&path=/var/log/ignite.log
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
No |
Should be log lowercase. |
|
|
integer |
Yes |
Number of line to start from. Parameter is mandatory if to is passed. |
|
|
string |
Yes |
The path to log file. If not provided the a default one is used. |
|
|
integer |
Yes |
Number to line to finish on. Parameter is mandatory if from is passed. |
|
Response Example
{
"error": "",
"response": ["[14:01:56,626][INFO ][test-runner][GridDiscoveryManager] Topology snapshot [ver=1, nodes=1, CPUs=8, heap=1.8GB]"],
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
string |
logs |
|
Version
Shows current Ignite version.
http://host:port/ignite?cmd=version
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be version lowercase. |
Response Example
{
"error": "",
"response": "1.0.0",
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
string |
Ignite version |
|
Activate
Starts the cluster activation process for a persistence-enabled cluster.
http://host:port/ignite?cmd=activate
Request Parameters
Name |
Type |
Optional |
Description |
Example |
cmd |
string |
Should be activate lowercase. |
Response Example
{
"successStatus":0,
"error":null,
"sessionToken":null,
"response":"activate started"
}
Name |
Type |
Description |
Example |
|
string |
Starts cluster activation. |
activate started |
Deactivate
Starts the deactivation process for a persistence-enabled cluster.
http://host:port/ignite?cmd=deactivate
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be deactivate lowercase. |
Response Example
{
"successStatus":0,
"error":null,
"sessionToken":null,
"response":"deactivate started"
}
Name |
Type |
Description |
Example |
|
string |
Starts cluster deactivation |
deactivate started |
Currentstate
Shows the current state(active/deactive) of the Ignite cluster.
http://host:port/ignite?cmd=currentstate
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be currentstate lowercase. |
Response Example
{
"successStatus":0,
"error":null,
"sessionToken":null,
"response":true
}
Name |
Type |
Description |
Example |
response |
string |
Returns |
|
Decrement
Subtracts and gets current value of given atomic long.
http://host:port/ignite?cmd=decr&cacheName=partitionedCache&key=decrKey&init=15&delta=10
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be decr lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
The name of atomic long. |
counter |
|
|
long |
Yes |
Initial value. |
15 |
|
long |
Number to be subtracted. |
42 |
Response Example
{
"affinityNodeId": "e05839d5-6648-43e7-a23b-78d7db9390d5",
"error": "",
"response": -42,
"successStatus": 0
}
Name |
Type |
Description |
Example |
response |
long |
Value after operation. |
-42 |
Increment
Adds and gets current value of given atomic long.
http://host:port/ignite?cmd=incr&cacheName=partitionedCache&key=incrKey&init=15&delta=10
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be incr lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
The name of atomic long. |
counter |
|
|
long |
Yes |
Initial value. |
15 |
|
long |
Number to be added. |
42 |
Response Example
{
"affinityNodeId": "e05839d5-6648-43e7-a23b-78d7db9390d5",
"error": "",
"response": 42,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
long |
Value after operation. |
42 |
Cache metrics
Shows metrics for Ignite cache.
http://host:port/ignite?cmd=cache&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be cache lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "",
"error": "",
"response": {
"hits": 0,
"misses": 0,
"reads": 0,
"writes": 2
},
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
The JSON object contains cache metrics such as create time, count reads and etc. |
|
Compare-And-Swap
Stores given key-value pair in cache only if the previous value is equal to the expected value passed in.
https://[host]:[port]/ignite?cmd=authenticate&ignite.login=[user]&ignite.password=[password]
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be cas lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key to store in cache. |
name |
|
|
string |
Value associated with the given key. |
Jack |
|
|
string |
Expected value. |
Bob |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Prepend
Prepends a line for value which is associated with key.
http://host:port/ignite?cmd=prepend&key=prependKey&val=prefix_&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be prepend lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key to store in cache. |
name |
|
|
string |
Value to be prepended to the current value. |
Name_ |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Append
Appends a line for value which is associated with key.
http://host:port/ignite?cmd=append&key=appendKey&val=_suffix&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be append lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key to store in cache. |
name |
|
|
string |
Value to be appended to the current value. |
Jack |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Replace
Stores a given key-value pair in cache only if there is a previous mapping for it.
http://host:port/ignite?cmd=rep&key=repKey&val=newValue&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be rep lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key to store in cache. |
name |
|
|
string |
Value associated with the given key. |
Jack |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Get and replace
Stores a given key-value pair in cache only if there is a previous mapping for it.
http://host:port/ignite?cmd=getrep&key=repKey&val=newValue&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be getrep lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key to store in cache. |
name |
|
|
string |
Value associated with the given key. |
Jack |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": oldValue,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
The previous value associated with the specified key. |
|
Replace Value
Replaces the entry for a key only if currently mapped to a given value.
http://host:port/ignite?cmd=repval&key=repKey&val=newValue&val2=oldVal&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be repval lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key to store in cache. |
name |
|
|
string |
Value associated with the given key. |
Jack |
|
|
string |
Value expected to be associated with the specified key. |
oldValue |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Remove all
Removes given key mappings from cache.
http://host:port/ignite?cmd=rmvall&k1=rmKey1&k2=rmKey2&k3=rmKey3&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be rmvall lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Keys whose mappings are to be removed from cache. |
name |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Remove value
Removes the mapping for a key only if currently mapped to the given value.
http://host:port/ignite?cmd=rmvval&key=rmvKey&val=rmvVal&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be rmvval lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key whose mapping is to be removed from the cache. |
name |
|
|
string |
Value expected to be associated with the specified key. |
oldValue |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Remove
Removes the given key mapping from cache.
http://host:port/ignite?cmd=rmv&key=rmvKey&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be rmv lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key - for which the mapping is to be removed from cache. |
name |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Get and remove
Removes the given key mapping from cache and returns the previous value.
http://host:port/ignite?cmd=getrmv&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647&key=name
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be getrmv lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key whose mapping is to be removed from the cache. |
name |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": value,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
Value for the key. |
|
Add
Stores a given key-value pair in cache only if there isn’t a previous mapping for it.
http://host:port/ignite?cmd=add&key=newKey&val=newValue&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be add lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key to be associated with the value. |
name |
|
|
string |
Value to be associated with the key. |
Jack |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Put all
Stores the given key-value pairs in cache.
http://host:port/ignite?cmd=putall&k1=putKey1&k2=putKey2&k3=putKey3&v1=value1&v2=value2&v3=value3&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be putall lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Keys to be associated with values. |
name |
|
|
string |
Values to be associated with keys. |
Jack |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Put
Stores the given key-value pair in cache.
http://host:port/ignite?cmd=put&key=newKey&val=newValue&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be put lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key to be associated with values. |
name |
|
|
string |
Value to be associated with keys. |
Jack |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "1bcbac4b-3517-43ee-98d0-874b103ecf30",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Get all
Retrieves values mapped to the specified keys from cache.
http://host:port/ignite?cmd=getall&k1=getKey1&k2=getKey2&k3=getKey3&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be getall lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Keys whose associated values are to be returned. |
key1, key2, …, keyN |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "",
"error": "",
"response": {
"key1": "value1",
"key2": "value2"
},
"successStatus": 0
}
Name |
Type |
Description |
Example |
response |
|
The map of key-value pairs. |
|
Get
Retrieves value mapped to the specified key from cache.
http://host:port/ignite?cmd=get&key=getKey&cacheName=partitionedCache&destId=8daab5ea-af83-4d91-99b6-77ed2ca06647
You can also get objects that were inserted via API, or SQL. For example, if you have a "Person" object in cache, you can obtain it the following way:
# If the entry in cache was inserted via API, for example
# cache.put(1, new Person(1, Alex, 300));
# you can use the following REST command to get the value
http://host:port/ignite?cmd=get&cacheName=myCacheName&keyType=int&key=1
# If the entry in cache was inserted via SQL, for example -
# create table person(id integer primary key, name varchar(100), salary integer);
# insert into person(id, name, salary) values (1, Alex, 300);
# you can use the following REST command to get the value
http://host:port/ignite?cmd=get&cacheName=SQL_PUBLIC_PERSON&keyType=int&key=1
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be get lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key whose associated value is to be returned. |
testKey |
|
|
Java built-in type |
Yes |
See Data Types for more details. |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
# If the entry in cache was inserted via API, for example
# cache.put(1, new Person(1, Alex, 300));
# you can use the following REST command to get the value
http://host:port/ignite?cmd=get&cacheName=myCacheName&keyType=int&key=1
# If the entry in cache was inserted via SQL, for example -
# create table person(id integer primary key, name varchar(100), salary integer);
# insert into person(id, name, salary) values (1, Alex, 300);
# you can use the following REST command to get the value
http://host:port/ignite?cmd=get&cacheName=SQL_PUBLIC_PERSON&keyType=int&key=1
Name |
Type |
Description |
Example |
|
jsonObject |
Value for the given key. |
|
Contains key
Determines if cache contains an entry for the specified key.
http://host:port/ignite?cmd=conkey&key=getKey&cacheName=partitionedCache
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be conkey lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key whose presence in this cache is to be tested. |
testKey |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "2bd7b049-3fa0-4c44-9a6d-b5c7a597ce37",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Contains keys
Determines if cache contains any entries for the specified keys.
http://host:port/ignite?cmd=conkeys&k1=getKey1&k2=getKey2&k3=getKey3&cacheName=partitionedCache
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be conkeys lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key whose presence in this cache is to be tested. |
key1, key2, …, keyN |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "2bd7b049-3fa0-4c44-9a6d-b5c7a597ce37",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Get and put
Stores the given key-value pair in cache and returns an existing value if one existed.
http://host:port/ignite?cmd=getput&key=getKey&val=newVal&cacheName=partitionedCache
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be getput lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key to be associated with value. |
name |
|
|
string |
Value to be associated with key. |
Jack |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "2bd7b049-3fa0-4c44-9a6d-b5c7a597ce37",
"error": "",
"response": "value",
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
Previous value for the given key. |
|
Put if absent
Stores given key-value pair in cache only if cache had no previous mapping for it.
http://host:port/ignite?cmd=putifabs&key=getKey&val=newVal&cacheName=partitionedCache
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be putifabs lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key to be associated with value. |
name |
|
|
string |
Value to be associated with key. |
Jack |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "2bd7b049-3fa0-4c44-9a6d-b5c7a597ce37",
"error": "",
"response": true,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
boolean |
|
true |
Get and put if absent
Stores given key-value pair in cache only if cache had no previous mapping for it. If cache previously contained value for the given key, then this value is returned.
http://host:port/ignite?cmd=getputifabs&key=getKey&val=newVal&cacheName=partitionedCache
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be getputifabs lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
|
string |
Key to be associated with value. |
name |
|
|
string |
Value to be associated with key. |
Jack |
|
|
string |
Yes |
Node ID for which the metrics are to be returned. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"affinityNodeId": "2bd7b049-3fa0-4c44-9a6d-b5c7a597ce37",
"error": "",
"response": "value",
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
Previous value for the given key. |
|
Cache size
Gets the number of all entries cached across all nodes.
http://host:port/ignite?cmd=size&cacheName=partitionedCache
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be size lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
Response Example
{
"affinityNodeId": "",
"error": "",
"response": 1,
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
number |
Number of all entries cached across all nodes. |
5 |
Cache metadata
Gets metadata for Ignite cache.
http://host:port/ignite?cmd=metadata&cacheName=partitionedCache
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
String |
Should be metadata lowercase. |
||
|
String |
Yes |
Cache name. If not provided, metadata for all user caches will be returned. |
partitionedCache |
Response Example
{
"error": "",
"response": {
"cacheName": "partitionedCache",
"types": [
"Person"
],
"keyClasses": {
"Person": "java.lang.Integer"
},
"valClasses": {
"Person": "org.apache.ignite.Person"
},
"fields": {
"Person": {
"_KEY": "java.lang.Integer",
"_VAL": "org.apache.ignite.Person",
"ID": "java.lang.Integer",
"FIRSTNAME": "java.lang.String",
"LASTNAME": "java.lang.String",
"SALARY": "double"
}
},
"indexes": {
"Person": [
{
"name": "ID_IDX",
"fields": [
"id"
],
"descendings": [],
"unique": false
},
{
"name": "SALARY_IDX",
"fields": [
"salary"
],
"descendings": [],
"unique": false
}
]
}
},
"sessionToken": "",
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
Metadata for Ignite cache. |
|
Get or create cache
Creates a cache with the given name if it does not exist.
http://host:port/ignite?cmd=getorcreate&cacheName=mypartitionedCache
Request Parameters
Name |
Type |
Optional |
Description |
|
String |
Should be getorcreate lowercase. |
|
|
String |
Yes |
Cache name. If not provided, default cache will be used. |
|
int |
Yes |
Number of backups for cache data. Default is 0. |
|
String |
Yes |
Name of the data region the cache should belong to. |
|
String |
Yes |
Name of the cache template registered in Ignite to use as a configuration for the distributed cache. See the Cache Template section for more information. |
|
String |
Yes |
Name of the group the cache should belong to. |
|
String |
Yes |
Sets the write synchronization mode for the given cache:
|
Response Example
{
"error": "",
"response": null,
"successStatus": 0
}
Destroy cache
Destroys cache with given name.
http://host:port/ignite?cmd=destcache&cacheName=partitionedCache
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be destcache lowercase. |
||
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
partitionedCache |
Response Example
{
"error": "",
"response": null,
"successStatus": 0
}
Node
Gets information about a node.
http://host:port/ignite?cmd=node&attr=true&mtr=true&id=c981d2a1-878b-4c67-96f6-70f93a4cd241
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be node lowercase. |
||
|
boolean |
Yes |
Response will include metrics, if this parameter is |
true |
|
boolean |
Yes |
Response will include attributes, if this parameter is |
true |
|
string |
This parameter is optional, if id parameter is passed. Response will be returned for node which has the IP. |
192.168.0.1 |
|
|
string |
This parameter is optional, if ip parameter is passed. Response will be returned for node which has the node ID. |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
|
|
boolean |
Yes |
When set to When set to Default value is |
true |
Response Example
{
"error": "",
"response": {
"attributes": null,
"caches": {},
"consistentId": "127.0.0.1:47500",
"defaultCacheMode": "REPLICATED",
"metrics": null,
"nodeId": "2d0d6510-6fed-4fa3-b813-20f83ac4a1a9",
"replicaCount": 128,
"tcpAddresses": ["127.0.0.1"],
"tcpHostNames": [""],
"tcpPort": 11211
},
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
Information about only one node. |
|
Topology
Gets information about grid topology.
http://host:port/ignite?cmd=top&attr=true&mtr=true&id=c981d2a1-878b-4c67-96f6-70f93a4cd241
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be top lowercase. |
||
|
boolean |
Yes |
Response will include metrics, if this parameter is |
true |
|
boolean |
Yes |
Response will include attributes, if this parameter is |
true |
|
string |
Yes |
This parameter is optional, if the |
192.168.0.1 |
|
string |
Yes |
This parameter is optional, if the |
8daab5ea-af83-4d91-99b6-77ed2ca06647 |
Response Example
{
"error": "",
"response": [
{
"attributes": {
...
},
"caches": [
{
name: "",
mode: "PARTITIONED"
},
{
name: "partitionedCache",
mode: "PARTITIONED",
sqlSchema: "partitionedCache"
}
],
"consistentId": "127.0.0.1:47500",
"metrics": {
...
},
"nodeId": "96baebd6-dedc-4a68-84fd-f804ee1ed995",
"replicaCount": 128,
"tcpAddresses": ["127.0.0.1"],
"tcpHostNames": [""],
"tcpPort": 11211
},
{
"attributes": {
...
},
"caches": [
{
name: "",
mode: "REPLICATED"
}
],
"consistentId": "127.0.0.1:47501",
"metrics": {
...
},
"nodeId": "2bd7b049-3fa0-4c44-9a6d-b5c7a597ce37",
"replicaCount": 128,
"tcpAddresses": ["127.0.0.1"],
"tcpHostNames": [""],
"tcpPort": 11212
}
],
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
Information about grid topology. |
|
Execute
Executes given task on grid.
http://host:port/ignite?cmd=exe&name=taskName&p1=param1&p2=param2&async=true
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be exe lowercase. |
||
|
string |
Name of the task to execute. |
summ |
|
|
string |
Yes |
Argument of task execution. |
arg1…argN |
|
boolean |
Yes |
Determines whether the task is performed asynchronously. |
true |
Response Example
{
"error": "",
"response": {
"error": "",
"finished": true,
"id": "~ee2d1688-2605-4613-8a57-6615a8cbcd1b",
"result": 4
},
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
JSON object contains message about error, unique identifier of task, result of computation and status of computation. |
|
Result
Returns computation result for the given task.
http://host:port/ignite?cmd=res&id=8daab5ea-af83-4d91-99b6-77ed2ca06647
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be res lowercase. |
||
|
string |
ID of the task whose result is to be returned. |
69ad0c48941-4689aae0-6b0e-4d52-8758-ce8fe26f497d~4689aae0-6b0e-4d52-8758-ce8fe26f497d |
Response Example
{
"error": "",
"response": {
"error": "",
"finished": true,
"id": "69ad0c48941-4689aae0-6b0e-4d52-8758-ce8fe26f497d~4689aae0-6b0e-4d52-8758-ce8fe26f497d",
"result": 4
},
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
JSON object contains information about error, ID of task, result of computation, and status of computation. |
|
SQL query execute
Runs SQL query over cache.
http://host:port/ignite?cmd=qryexe&type=Person&pageSize=10&cacheName=Person&arg1=1000&arg2=2000&qry=salary+%3E+%3F+and+salary+%3C%3D+%3F
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be qryexe lowercase. |
||
|
string |
Type for the query |
String |
|
|
number |
Page size for the query. |
3 |
|
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
testCache |
|
string |
Query arguments |
1000,2000 |
|
|
strings |
Encoding sql query |
salary+%3E+%3F+and+salary+%3C%3D+%3F |
Response Example
{
"error":"",
"response":{
"fieldsMetadata":[],
"items":[
{"key":3,"value":{"name":"Jane","id":3,"salary":2000}},
{"key":0,"value":{"name":"John","id":0,"salary":2000}}],
"last":true,
"queryId":0},
"successStatus":0
}
Name |
Type |
Description |
Example |
|
jsonObject |
JSON object contains result items for query, flag for last page, and |
|
SQL fields query execute
Runs SQL fields query over cache.
http://host:port/ignite?cmd=qryfldexe&pageSize=10&cacheName=Person&qry=select+firstName%2C+lastName+from+Person
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be qryfldexe lowercase. |
||
|
number |
Page size for the query. |
3 |
|
|
string |
Yes |
Cache name. If not provided, default cache will be used. |
testCache |
|
string |
Query arguments. |
1000,2000 |
|
|
strings |
Encoding sql fields query. |
select+firstName%2C+lastName+from+Person |
Response Example
{
"error": "",
"response": {
"fieldsMetadata": [
{
"fieldName": "FIRSTNAME",
"fieldTypeName": "java.lang.String",
"schemaName": "person",
"typeName": "PERSON"
},
{
"fieldName": "LASTNAME",
"fieldTypeName": "java.lang.String",
"schemaName": "person",
"typeName": "PERSON"
}
],
"items": [["Jane", "Doe" ], ["John", "Doe"]],
"last": true,
"queryId": 0
},
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
JSON object contains result items for query, fields query metadata, flag for last page, and |
|
SQL scan query execute
Runs scan query over cache.
http://host:port/ignite?cmd=qryscanexe&pageSize=10&cacheName=Person&className=org.apache.ignite.filters.PersonPredicate
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
String |
Should be qryscanexe lowercase. |
||
|
Number |
Page size for the query |
3 |
|
|
String |
Yes |
Cache name. If not provided, default cache will be used. |
testCache |
|
String |
Yes |
Predicate class name for scan query. Class should implement |
org.apache.ignite.filters.PersonPredicate |
Response Example
{
"error": "",
"response": {
"fieldsMetadata": [
{
"fieldName": "key",
"fieldTypeName": "",
"schemaName": "",
"typeName": ""
},
{
"fieldName": "value",
"fieldTypeName": "",
"schemaName": "",
"typeName": ""
}
],
"items": [
{
"key": 1,
"value": {
"firstName": "Jane",
"id": 1,
"lastName": "Doe",
"salary": 1000
}
},
{
"key": 3,
"value": {
"firstName": "Jane",
"id": 3,
"lastName": "Smith",
"salary": 2000
}
}
],
"last": true,
"queryId": 0
},
"successStatus": 0
}
Name |
Type |
Description |
Example |
|
jsonObject |
JSON object contains result items for scan query, fields query metadata, flag for last page, and |
|
SQL query fetch
Gets next page for the query.
http://host:port/ignite?cmd=qryfetch&pageSize=10&qryId=5
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be qryfetch lowercase. |
||
|
number |
Page size for the query. |
3 |
|
|
number |
Query id that is returned from the |
0 |
Response Example
{
"error":"",
"response":{
"fieldsMetadata":[],
"items":[["Jane","Doe"],["John","Doe"]],
"last":true,
"queryId":0
},
"successStatus":0
}
Name |
Type |
Description |
Example |
|
jsonObject |
JSON object contains result items for query, flag for last page, and |
|
SQL query close
Closes query resources.
http://host:port/ignite?cmd=qrycls&qryId=5
Request Parameters
Name |
Type |
Optional |
Description |
Example |
|
string |
Should be qrycls lowercase. |
||
|
number |
Query id that is returned from the |
0 |
Response Example
{
"error":"",
"response":true,
"successStatus":0
}
Name |
Type |
Description |
Example |
response |
boolean |
|
true |
General Configuration
Parameter Name | Description | Optional | Default Value |
---|---|---|---|
|
Defines secret key used for client authentication. When provided, client request must contain |
Yes |
|
|
Port range for Jetty server. If the port provided in Jetty configuration or |
Yes |
|
|
Path to Jetty configuration file. Should be either absolute or relative to |
Yes |
|
|
The interceptor provides the ability to transform all objects exchanged via REST protocol. For example if you use custom serialisation on client you can write an interceptor to transform binary representations received from the client to Java objects and later access them from Java code directly. |
Yes |
|
Sample Jetty XML Configuration
Path to this configuration should be set to ConnectorConfiguration.setJettyPath(String)
as explained above.
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Arg name="threadPool">
<!-- Default queued blocking thread pool -->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">20</Set>
<Set name="maxThreads">200</Set>
</New>
</Arg>
<New id="httpCfg" class="org.eclipse.jetty.server.HttpConfiguration">
<Set name="secureScheme">https</Set>
<Set name="securePort">8443</Set>
<Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set>
</New>
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server"/></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Ref refid="httpCfg"/>
</New>
</Item>
</Array>
</Arg>
<Set name="host">
<SystemProperty name="IGNITE_JETTY_HOST" default="localhost"/>
</Set>
<Set name="port">
<SystemProperty name="IGNITE_JETTY_PORT" default="8080"/>
</Set>
<Set name="idleTimeout">30000</Set>
<Set name="reuseAddress">true</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Item>
</Array>
</Set>
</New>
</Set>
<Set name="stopAtShutdown">false</Set>
</Configure>
© 2020 GridGain Systems, Inc. All Rights Reserved. Privacy Policy | Legal Notices. GridGain® is a registered trademark of GridGain Systems, Inc.
Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are either registered trademarks or trademarks of The Apache Software Foundation.