Data Grid REST API
Configure and interact with the Data Grid REST API
Abstract
Red Hat Data Grid Copy linkLink copied to clipboard!
Data Grid is a high-performance, distributed in-memory data store.
- Schemaless data structure
- Flexibility to store different objects as key-value pairs.
- Grid-based data storage
- Designed to distribute and replicate data across clusters.
- Elastic scaling
- Dynamically adjust the number of nodes to meet demand without service disruption.
- Data interoperability
- Store, retrieve, and query data in the grid from different endpoints.
Data Grid documentation Copy linkLink copied to clipboard!
Documentation for Data Grid is available on the Red Hat customer portal.
Data Grid downloads Copy linkLink copied to clipboard!
Access the Data Grid Software Downloads on the Red Hat customer portal.
You must have a Red Hat account to access and download Data Grid software.
Making open source more inclusive Copy linkLink copied to clipboard!
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message.
Chapter 1. Data Grid REST Endpoint Copy linkLink copied to clipboard!
Data Grid servers provide RESTful HTTP access to data through a REST endpoint built on Netty.
1.1. REST Authentication Copy linkLink copied to clipboard!
Configure authentication to the REST endpoint with the Data Grid command line interface (CLI) and the user command. The CLI lets you create and manage users, passwords, and authorization roles for accessing the REST endpoint.
1.2. Supported Protocols Copy linkLink copied to clipboard!
The Data Grid REST endpoint supports HTTP/1.1
and HTTP/2
protocols.
You can do either of the following to use HTTP/2
:
- Perform an HTTP/1.1 upgrade.
- Negotiate the communication protocol using a TLS/ALPN extension.
1.3. Data Formats and the REST API Copy linkLink copied to clipboard!
Data Grid caches store data in formats that you can define with a MediaType.
See the Cache Encoding and Marshalling for more information about MediaTypes and encoding data with Data Grid.
The following example configures the storage format for entries:
If you do not configure a MediaType, Data Grid defaults to application/octet-stream
for both keys and values. However, if the cache is indexed, Data Grid defaults to application/x-protostream
.
1.3.1. Supported Formats Copy linkLink copied to clipboard!
You can write and read data in different formats and Data Grid can convert between those formats when required.
The following "standard" formats are interchangeable:
-
application/x-java-object
-
application/octet-stream
-
application/x-www-form-urlencoded
-
text/plain
You can also convert the preceding data formats into the following formats:
-
application/xml
-
application/json
-
application/x-jboss-marshalling
-
application/x-protostream
-
application/x-java-serialized
Data Grid also lets you convert between application/x-protostream
and application/json
.
All calls to the REST API can provide headers describing the content written or the required format of the content when reading. Data Grid supports the standard HTTP/1.1 headers "Content-Type" and "Accept" that are applied for values, plus the "Key-Content-Type" with similar effect for keys.
1.3.2. Accept Headers Copy linkLink copied to clipboard!
The Data Grid REST endpoint is compliant with the RFC-2616 Accept header and negotiates the correct MediaType based on the conversions supported.
For example, send the following header when reading data:
Accept: text/plain;q=0.7, application/json;q=0.8, */*;q=0.6
Accept: text/plain;q=0.7, application/json;q=0.8, */*;q=0.6
The preceding header causes Data Grid to first return content in JSON format (higher priority 0.8). If it is not possible to convert the storage format to JSON, Data Grid attempts the next format of text/plain
(second highest priority 0.7). Finally, Data Grid falls back to */*, which picks a suitable format based on the cache configuration.
1.3.3. Names with Special Characters Copy linkLink copied to clipboard!
The creation of any REST resource requires a name that is part of the URL, and in case this name contains any special characters as defined in Section 2.2 of the RFC 3986 spec, it is necessary to encode it with the Percent encoding mechanism.
1.3.4. Key-Content-Type Headers Copy linkLink copied to clipboard!
Most REST API calls have the Key included in the URL. Data Grid assumes the Key is a java.lang.String
when handling those calls, but you can use a specific header Key-Content-Type
for keys in different formats.
Key-Content-Type Header Examples
- Specifying a byte[] Key as a Base64 string:
API call:
`PUT /my-cache/AQIDBDM=`
`PUT /my-cache/AQIDBDM=`
Headers:
Key-Content-Type: application/octet-stream
- Specifying a byte[] Key as a hexadecimal string:
API call:
GET /my-cache/0x01CA03042F
Headers:
Key-Content-Type: application/octet-stream; encoding=hex
Key-Content-Type: application/octet-stream; encoding=hex
- Specifying a double Key:
API call:
POST /my-cache/3.141456
Headers:
Key-Content-Type: application/x-java-object;type=java.lang.Double
Key-Content-Type: application/x-java-object;type=java.lang.Double
The type parameter for application/x-java-object
is restricted to:
- Primitive wrapper types
-
java.lang.String
-
Bytes, making
application/x-java-object;type=Bytes
equivalent toapplication/octet-stream;encoding=hex
.
1.3.5. JSON/Protostream Conversion Copy linkLink copied to clipboard!
When caches are indexed, or specifically configured to store application/x-protostream
, you can send and receive JSON documents that are automatically converted to and from Protobuf.
You must register a Protobuf schema for the conversion to work.
To register protobuf schemas via REST, invoke a POST
or PUT
in the ___protobuf_metadata
cache as in the following example:
curl -u user:password -X POST --data-binary @./schema.proto http://127.0.0.1:11222/rest/v2/caches/___protobuf_metadata/schema.proto
curl -u user:password -X POST --data-binary @./schema.proto http://127.0.0.1:11222/rest/v2/caches/___protobuf_metadata/schema.proto
When writing JSON documents, a special field _type must be present in the document to identity the Protobuf Message that corresponds to the document.
Person.proto
message Person { required string name = 1; required int32 age = 2; }
message Person {
required string name = 1;
required int32 age = 2;
}
Person.json
{ "_type": "Person", "name": "user1", "age": 32 }
{
"_type": "Person",
"name": "user1",
"age": 32
}
1.4. Cross-Origin Resource Sharing (CORS) Requests Copy linkLink copied to clipboard!
The Data Grid REST connector supports CORS, including preflight and rules based on the request origin.
The following shows an example REST connector configuration with CORS rules:
Data Grid evaluates CORS rules sequentially based on the "Origin" header set by the browser.
In the preceding example, if the origin is either "http://host1" or "https://host1", then the rule "restrict host1" applies. If the origin is different, then the next rule is tested.
Because the "allow ALL" rule permits all origins, any script that has an origin other than "http://host1" or "https://host1" can perform the allowed methods and use the supplied headers.
For information about configuring CORS rules, see the Data Grid Server Configuration Schema.
1.4.1. Allowing all CORS permissions for some origins Copy linkLink copied to clipboard!
The VM property infinispan.server.rest.cors-allow
can be used when starting the server to allow all permissions to one or more origins. Example:
./bin/server.sh -Dinfinispan.server.rest.cors-allow=http://192.168.1.78:11222,http://host.mydomain.com
./bin/server.sh -Dinfinispan.server.rest.cors-allow=http://192.168.1.78:11222,http://host.mydomain.com
All origins specified using this method will take precedence over the configured rules.
Chapter 2. Interacting with the Data Grid REST API Copy linkLink copied to clipboard!
The Data Grid REST API lets you monitor, maintain, and manage Data Grid deployments and provides access to your data.
By default Data Grid REST API operations return 200 (OK)
when successful. However, when some operations are processed successfully, they return an HTTP status code such as 204
or 202
instead of 200
.
2.1. Creating and Managing Caches Copy linkLink copied to clipboard!
Create and manage Data Grid caches and perform operations on data.
2.1.1. Creating Caches Copy linkLink copied to clipboard!
Create named caches across Data Grid clusters with POST
requests that include XML or JSON configuration in the payload.
POST /rest/v2/caches/{cacheName}
POST /rest/v2/caches/{cacheName}
Header | Required or Optional | Parameter |
---|---|---|
| REQUIRED |
Sets the MediaType for the Data Grid configuration payload; either |
| OPTIONAL | Used to set AdminFlags |
2.1.1.1. Cache configuration Copy linkLink copied to clipboard!
You can create declarative cache configuration in XML, JSON, and YAML format.
All declarative caches must conform to the Data Grid schema. Configuration in JSON format must follow the structure of an XML configuration, elements correspond to objects and attributes correspond to fields.
Data Grid restricts characters to a maximum of 255
for a cache name or a cache template name. If you exceed this character limit, Data Grid throws an exception. Write succinct cache names and cache template names.
A file system might set a limitation for the length of a file name, so ensure that a cache’s name does not exceed this limitation. If a cache name exceeds a file system’s naming limitation, general operations or initialing operations towards that cache might fail. Write succinct file names.
Distributed caches
XML
JSON
YAML
Replicated caches
XML
JSON
YAML
Multiple caches
XML
JSON
YAML
2.1.2. Modifying Caches Copy linkLink copied to clipboard!
Make changes to attributes in cache configurations across Data Grid clusters with PUT
requests that include XML or JSON configuration in the payload.
You can modify a cache only if the changes are compatible with the existing configuration.
For example you cannot use a replicated cache configuration to modify a distributed cache. Likewise if you create a cache configuration with a specific attribute, you cannot modify the configuration to use a different attribute instead. For example, attempting to modify cache configuration by specifying a value for the max-count
attribute results in invalid configuration if the max-size
is already set.
PUT /rest/v2/caches/{cacheName}
PUT /rest/v2/caches/{cacheName}
Header | Required or Optional | Parameter |
---|---|---|
| REQUIRED |
Sets the MediaType for the Data Grid configuration payload; either |
| OPTIONAL | Used to set AdminFlags |
2.1.3. Verifying Caches Copy linkLink copied to clipboard!
Check if a cache exists in Data Grid clusters with HEAD
requests.
HEAD /rest/v2/caches/{cacheName}
HEAD /rest/v2/caches/{cacheName}
Retrieve a caches health with GET
requests.
GET /rest/v2/caches/{cacheName}?action=health
GET /rest/v2/caches/{cacheName}?action=health
2.1.4. Creating Caches with Templates Copy linkLink copied to clipboard!
Create caches from Data Grid templates with POST
requests and the ?template=
parameter.
POST /rest/v2/caches/{cacheName}?template={templateName}
POST /rest/v2/caches/{cacheName}?template={templateName}
See Listing Available Cache Templates.
2.1.5. Retrieving Cache Configuration Copy linkLink copied to clipboard!
Retrieve Data Grid cache configurations with GET
requests.
GET /rest/v2/caches/{name}?action=config
GET /rest/v2/caches/{name}?action=config
Header | Required or Optional | Parameter |
---|---|---|
| OPTIONAL |
Sets the required format to return content. Supported formats are |
2.1.6. Converting Cache Configurations between XML, JSON and YAML Copy linkLink copied to clipboard!
Invoke a POST
request with valid configuration and the ?action=convert
parameter. Data Grid responds with the equivalent representation of the configuration in the type specified by the Accept
header.
POST /rest/v2/caches?action=convert
POST /rest/v2/caches?action=convert
To convert cache configuration you must specify the input format for the configuration with the Content-Type
header and the desired output format with the Accept
header. For example, the following command converts the replicated cache configuration from XML to YAML:
curl localhost:11222/rest/v2/caches?action=convert \ --digest -u username:password \ -X POST -H "Accept: application/yaml" -H "Content-Type: application/xml" \ -d '<replicated-cache mode="SYNC" statistics="false"><encoding media-type="application/x-protostream"/><expiration lifespan="300000" /><memory max-size="400MB" when-full="REMOVE"/></replicated-cache>'
curl localhost:11222/rest/v2/caches?action=convert \
--digest -u username:password \
-X POST -H "Accept: application/yaml" -H "Content-Type: application/xml" \
-d '<replicated-cache mode="SYNC" statistics="false"><encoding media-type="application/x-protostream"/><expiration lifespan="300000" /><memory max-size="400MB" when-full="REMOVE"/></replicated-cache>'
2.1.7. Comparing Cache Configurations Copy linkLink copied to clipboard!
Invoke a POST
request with a multipart/form-data
body containing two cache configurations and the ?action=compare
parameter.
POST /rest/v2/caches?action=compare
POST /rest/v2/caches?action=compare
Add the ignoreMutable=true
parameter to ignore mutable attributes in the comparison.
Data Grid responds with 204 (No Content)
in case the configurations are equal, and 409 (Conflict)
in case they are different.
2.1.8. Retrieving All Cache Details Copy linkLink copied to clipboard!
Invoke a GET
request to retrieve all details for Data Grid caches.
GET /rest/v2/caches/{name}?action=stats
GET /rest/v2/caches/{name}?action=stats
Data Grid provides a JSON response such as the following:
-
stats
current stats of the cache. -
size
the estimated size for the cache. -
configuration
the cache configuration. -
rehash_in_progress
true when a rehashing is in progress. -
indexing_in_progress
true when indexing is in progress. -
rebalancing_enabled
is true if rebalancing is enabled. Fetching this property might fail on the server. In that case the property won’t be present in the payload. -
bounded
when expiration is enabled. -
indexed
true if the cache is indexed. -
persistent
true if the cache is persisted. -
transactional
true if the cache is transactional. -
secured
true if the cache is secured. -
has_remote_backup
true if the cache has remote backups. -
key_storage
the media type of the cache keys. -
value_storage
the media type of the cache values.
key_storage
and value_storage
matches encoding configuration of the cache. For server caches with no encoding, Data Grid assumes application/x-protostream
when a cache is indexed and application/unknown
otherwise.
2.1.9. Resetting All Cache Statistics Copy linkLink copied to clipboard!
Invoke a POST
request to reset all statistics for Data Grid caches.
POST /rest/v2/caches/{name}?action=stats-reset
POST /rest/v2/caches/{name}?action=stats-reset
2.1.10. Retrieving Data Distribution of a Cache Copy linkLink copied to clipboard!
Invoke a GET
request to retrieve all details for data distribution of Data Grid caches.
GET /rest/v2/caches/{name}?action=distribution
GET /rest/v2/caches/{name}?action=distribution
Data Grid provides a JSON response such as the following:
Each element in the list represents a node. The properties are:
-
node_name
is the node name -
node_addresses
is a list with all the node’s physical addresses. -
memory_entries
the number of entries the node holds in memory belonging to the cache. -
total_entries
the number of entries the node has in memory and disk belonging to the cache. -
memory_used
the value in bytes the eviction algorithm estimates the cache occupies. Returns -1 if eviction is not enabled.
2.1.11. Retrieving all mutable cache configuration attributes Copy linkLink copied to clipboard!
Invoke a GET
request to retrieve all mutable cache configuration attributes for Data Grid caches.
GET /rest/v2/caches/{name}?action=get-mutable-attributes
GET /rest/v2/caches/{name}?action=get-mutable-attributes
Data Grid provides a JSON response such as the following:
Add the full
parameter to obtain values and type information:
GET /rest/v2/caches/mycache?action=get-mutable-attributes&full=true
GET /rest/v2/caches/mycache?action=get-mutable-attributes&full=true
Data Grid provides a JSON response such as the following:
For attributes of type enum
, an additional universe
property will contain the set of possible values.
2.1.12. Updating cache configuration attributes Copy linkLink copied to clipboard!
Invoke a POST
request to change a mutable cache configuration attribute.
POST /rest/v2/caches/{name}?action=set-mutable-attributes&attribute-name={attributeName}&attribute-value={attributeValue}
POST /rest/v2/caches/{name}?action=set-mutable-attributes&attribute-name={attributeName}&attribute-value={attributeValue}
2.1.13. Adding Entries Copy linkLink copied to clipboard!
Add entries to caches with POST
requests.
POST /rest/v2/caches/{cacheName}/{cacheKey}
POST /rest/v2/caches/{cacheName}/{cacheKey}
The preceding request places the payload, or request body, in the cacheName
cache with the cacheKey
key. The request replaces any data that already exists and updates the Time-To-Live
and Last-Modified
values, if they apply.
If the entry is created successfully, the service returns 204 (No Content)
.
If a value already exists for the specified key, the POST
request returns 409 (Conflict)
and does not modify the value. To update values, you should use PUT
requests. See Replacing Entries.
Header | Required or Optional | Parameter |
---|---|---|
| OPTIONAL | Sets the content type for the key in the request. See Key-Content-Type for more information. |
| OPTIONAL | Sets the MediaType of the value for the key. |
| OPTIONAL | Sets the number of seconds before the entry is automatically deleted. If you do not set this parameter, Data Grid uses the default value from the configuration. If you set a negative value, the entry is never deleted. |
| OPTIONAL | Sets the number of seconds that entries can be idle. If a read or write operation does not occur for an entry after the maximum idle time elapses, the entry is automatically deleted. If you do not set this parameter, Data Grid uses the default value from the configuration. If you set a negative value, the entry is never deleted. |
| OPTIONAL | The flags used to add the entry. See Flag for more information. |
The flags
header also applies to all other operations involving data manipulation on the cache,
If both timeToLiveSeconds
and maxIdleTimeSeconds
have a value of 0
, Data Grid uses the default lifespan
and maxIdle
values from the configuration.
If only maxIdleTimeSeconds
has a value of 0
, Data Grid uses:
-
the default
maxIdle
value from the configuration. -
the value for
timeToLiveSeconds
that you pass as a request parameter or a value of-1
if you do not pass a value.
If only timeToLiveSeconds
has a value of 0
, Data Grid uses:
-
the default
lifespan
value from the configuration. -
the value for
maxIdle
that you pass as a request parameter or a value of-1
if you do not pass a value.
2.1.14. Replacing Entries Copy linkLink copied to clipboard!
Replace entries in caches with PUT
requests.
PUT /rest/v2/caches/{cacheName}/{cacheKey}
PUT /rest/v2/caches/{cacheName}/{cacheKey}
If a value already exists for the specified key, the PUT
request updates the value. If you do not want to modify existing values, use POST
requests that return 409 (Conflict)
instead of modifying values. See Adding Values.
2.1.15. Retrieving Data By Keys Copy linkLink copied to clipboard!
Retrieve data for specific keys with GET
requests.
GET /rest/v2/caches/{cacheName}/{cacheKey}
GET /rest/v2/caches/{cacheName}/{cacheKey}
The server returns data from the given cache, cacheName
, under the given key, cacheKey
, in the response body. Responses contain Content-Type
headers that correspond to the MediaType
negotiation.
Browsers can also access caches directly, for example as a content delivery network (CDN). Data Grid returns a unique ETag for each entry along with the Last-Modified
and Expires
header fields.
These fields provide information about the state of the data that is returned in your request. ETags allow browsers and other clients to request only data that has changed, which conserves bandwidth.
Header | Required or Optional | Parameter |
---|---|---|
| OPTIONAL |
Sets the content type for the key in the request. The default is |
| OPTIONAL | Sets the required format to return content. See Accept for more information. |
Append the extended
parameter to the query string to get additional information:
GET /rest/v2/caches/{cacheName}/{cacheKey}?extended
GET /rest/v2/caches/{cacheName}/{cacheKey}?extended
The preceding request returns custom headers:
-
Cluster-Primary-Owner
returns the node name that is the primary owner of the key. -
Cluster-Node-Name
returns the JGroups node name of the server that handled the request. -
Cluster-Physical-Address
returns the physical JGroups address of the server that handled the request.
2.1.16. Checking if Entries Exist Copy linkLink copied to clipboard!
Verify that specific entries exists with HEAD
requests.
HEAD /rest/v2/caches/{cacheName}/{cacheKey}
HEAD /rest/v2/caches/{cacheName}/{cacheKey}
The preceding request returns only the header fields and the same content that you stored with the entry. For example, if you stored a String, the request returns a String. If you stored binary, base64-encoded, blobs or serialized Java objects, Data Grid does not de-serialize the content in the request.
HEAD
requests also support the extended
parameter.
Header | Required or Optional | Parameter |
---|---|---|
| OPTIONAL |
Sets the content type for the key in the request. The default is |
2.1.17. Deleting Entries Copy linkLink copied to clipboard!
Remove entries from caches with DELETE
requests.
DELETE /rest/v2/caches/{cacheName}/{cacheKey}
DELETE /rest/v2/caches/{cacheName}/{cacheKey}
Header | Required or Optional | Parameter |
---|---|---|
| OPTIONAL |
Sets the content type for the key in the request. The default is |
2.1.18. Checking distribution of cache entries Copy linkLink copied to clipboard!
Invoke this endpoint to retrieve details for data distribution of Data Grid cache entry.
GET /rest/v2/caches/{cacheName}/{cacheKey}?action=distribution
GET /rest/v2/caches/{cacheName}/{cacheKey}?action=distribution
Data Grid provides a JSON response such as the following:
-
contains_key
returnstrue
if the cache contains the key -
owners
provides a list of nodes that contain the key
List of owners includes the following properties:
-
node_name
shows the name of the node -
primary
identifies a node that is the primary owner -
node_addresses
shows the IP addresses and ports where the node can be accessed
2.1.19. Deleting Caches Copy linkLink copied to clipboard!
Remove caches from Data Grid clusters with DELETE
requests.
DELETE /rest/v2/caches/{cacheName}
DELETE /rest/v2/caches/{cacheName}
2.1.20. Retrieving All Keys from Caches Copy linkLink copied to clipboard!
Invoke GET
requests to retrieve all the keys in a cache in JSON format.
GET /rest/v2/caches/{cacheName}?action=keys
GET /rest/v2/caches/{cacheName}?action=keys
Parameter | Required or Optional | Value |
---|---|---|
| OPTIONAL |
Specifies the maximum number of keys to retrieve using an InputStream. A negative value retrieves all keys. The default value is |
| OPTIONAL |
Specifies the internal batch size when retrieving the keys. The default value is |
2.1.21. Retrieving All Entries from Caches Copy linkLink copied to clipboard!
Invoke GET
requests to retrieve all the entries in a cache in JSON format.
GET /rest/v2/caches/{cacheName}?action=entries
GET /rest/v2/caches/{cacheName}?action=entries
Parameter | Required or Optional | Value |
---|---|---|
| OPTIONAL |
Includes metadata for each entry in the response. The default value is |
| OPTIONAL |
Specifies the maximum number of keys to include in the response. A negative value retrieves all keys. The default value is |
| OPTIONAL |
Specifies the internal batch size when retrieving the keys. The default value is |
| OPTIONAL |
If |
Data Grid provides a JSON response such as the following:
-
key
The key for the entry. -
value
The value of the entry. -
timeToLiveSeconds
Based on the entry lifespan but in seconds, or-1
if the entry never expires. It’s not returned unless you set metadata="true". -
maxIdleTimeSeconds
Maximum idle time, in seconds, or-1
if entry never expires. It’s not returned unless you set metadata="true". -
created
Time the entry was created or or-1
for immortal entries. It’s not returned unless you set metadata="true". -
lastUsed
Last time an operation was performed on the entry or-1
for immortal entries. It’s not returned unless you set metadata="true". -
expireTime
Time when the entry expires or-1
for immortal entries. It’s not returned unless you set metadata="true". -
version
The metadata version related to the cache entry. Only if the value is present. -
topologyId
The topology Id of a clustered version metadata. Only if the value is present.
2.1.22. Clearing Caches Copy linkLink copied to clipboard!
To delete all data from a cache, invoke a POST
request with the ?action=clear
parameter.
POST /rest/v2/caches/{cacheName}?action=clear
POST /rest/v2/caches/{cacheName}?action=clear
If the operation successfully completes, the service returns 204 (No Content)
.
2.1.23. Getting Cache Size Copy linkLink copied to clipboard!
Retrieve the size of caches across the entire cluster with GET
requests and the ?action=size
parameter.
GET /rest/v2/caches/{cacheName}?action=size
GET /rest/v2/caches/{cacheName}?action=size
2.1.24. Getting Cache Statistics Copy linkLink copied to clipboard!
Obtain runtime statistics for caches with GET
requests.
GET /rest/v2/caches/{cacheName}?action=stats
GET /rest/v2/caches/{cacheName}?action=stats
2.1.25. Listing Caches Copy linkLink copied to clipboard!
List all available caches in Data Grid clusters with GET
requests.
GET /rest/v2/caches/
GET /rest/v2/caches/
2.1.26. Obtaining Caches Status and Information Copy linkLink copied to clipboard!
Retrieve a list of all available caches for the cache manager, along with cache statuses and details, with GET
requests.
GET /rest/v2/caches?action=detailed
GET /rest/v2/caches?action=detailed
Data Grid responds with JSON arrays that lists and describes each available cache, as in the following example:
Parameter | Required or Optional | Description |
---|---|---|
| OPTIONAL |
If |
2.1.27. Listing accessible caches for a role Copy linkLink copied to clipboard!
When security is enabled, retrieve a list of all the accessible caches for a role. This operation requires ADMIN permission.
GET /rest/v2/caches?action=role-accessible&role=observer
GET /rest/v2/caches?action=role-accessible&role=observer
Data Grid responds with JSON as in the following example:
{ "secured" : ["securedCache1", "securedCache2"], "non-secured" : ["cache1", "cache2", "cache3"] }
{
"secured" : ["securedCache1", "securedCache2"],
"non-secured" : ["cache1", "cache2", "cache3"]
}
Parameter | Required or Optional | Description |
---|---|---|
| OPTIONAL |
If |
2.1.28. Listening to cache events Copy linkLink copied to clipboard!
Receive cache events using Server-Sent Events. The event
value will be one of cache-entry-created
, cache-entry-removed
, cache-entry-updated
, cache-entry-expired
. The data
value will contain the key of the entry that has fired the event in the format set by the Accept
header.
GET /rest/v2/caches/{name}?action=listen
GET /rest/v2/caches/{name}?action=listen
Header | Required or Optional | Parameter |
---|---|---|
| OPTIONAL |
Sets the required format to return content. Supported formats are |
2.1.29. Enabling rebalancing Copy linkLink copied to clipboard!
Turn on automatic rebalancing for a specific cache.
POST /rest/v2/caches/{cacheName}?action=enable-rebalancing
POST /rest/v2/caches/{cacheName}?action=enable-rebalancing
2.1.30. Disabling rebalancing Copy linkLink copied to clipboard!
Turn off automatic rebalancing for a specific cache.
POST /rest/v2/caches/{cacheName}?action=disable-rebalancing
POST /rest/v2/caches/{cacheName}?action=disable-rebalancing
2.1.31. Getting Cache Availability Copy linkLink copied to clipboard!
Retrieve the availability of a cache.
GET /rest/v2/caches/{cacheName}?action=get-availability
GET /rest/v2/caches/{cacheName}?action=get-availability
You can get the availability of internal caches but this is subject to change in future Data Grid versions.
2.1.32. Setting Cache Availability Copy linkLink copied to clipboard!
Change the availability of clustered caches when using either the DENY_READ_WRITES or ALLOW_READS partition handling strategy.
POST /rest/v2/caches/{cacheName}?action=set-availability&availability={AVAILABILITY}
POST /rest/v2/caches/{cacheName}?action=set-availability&availability={AVAILABILITY}
Parameter | Required or Optional | Value |
---|---|---|
| REQUIRED | AVAILABLE or DEGRADED_MODE |
-
AVAILABLE
makes caches available to all nodes in a network partition. -
DEGRADED_MODE
prevents read and write operations on caches when network partitions occur.
You can set the availability of internal caches but this is subject to change in future Data Grid versions.
2.1.33. Set a Stable Topology Copy linkLink copied to clipboard!
By default, after a cluster shutdown, Data Grid waits for all nodes to join the cluster and restore the topology. However, you can define the current cluster topology as stable for a specific cache using a REST operation.
POST /rest/v2/caches/{cacheName}?action=initialize&force={FORCE}
POST /rest/v2/caches/{cacheName}?action=initialize&force={FORCE}
Parameter | Required or Optional | Value |
---|---|---|
| OPTIONAL | true or false. |
-
force
is required when the number of missing nodes in the current topology is greater or equal to the number of owners.
Manually installing a topology can lead to data loss, only perform this operation if the initial topology cannot be recreated.
2.1.34. Indexing and Querying with the REST API Copy linkLink copied to clipboard!
Query remote caches with GET
requests and the ?action=search&query
parameter from any HTTP client.
GET /rest/v2/caches/{cacheName}?action=search&query={ickle query}
GET /rest/v2/caches/{cacheName}?action=search&query={ickle query}
Data Grid response
-
hit_count
shows the total number of results from the query. -
hit_count_exact
istrue
which means thehit_count
is exact. When it’sfalse
, it implies that the hit count value is a lower bound. -
hits
represents an array of individual matches from the query. hit
refers to each object that corresponds to a match in the query.TipHits can contain all fields or a subset of fields if you use a
Select
clause.
Parameter | Required or Optional | Value |
---|---|---|
| REQUIRED | Specifies the query string. |
| OPTIONAL |
Specifies the index of the first result to return. The default is |
| OPTIONAL |
Sets the number of results to return. The default is |
| OPTIONAL |
Limits the required accuracy of the hit count for the indexed queries to an upper-bound. The default is |
| OPTIONAL |
When |
To use the body of the request instead of specifying query parameters, invoke POST
requests as follows:
POST /rest/v2/caches/{cacheName}?action=search
POST /rest/v2/caches/{cacheName}?action=search
Query in request body
{ "query":"from Entity where name:\"user1\"", "max_results":20, "offset":10 }
{
"query":"from Entity where name:\"user1\"",
"max_results":20,
"offset":10
}
2.1.34.1. Rebuilding indexes Copy linkLink copied to clipboard!
When you delete fields or change index field definitions, you must rebuild the index to ensure the index is consistent with data in the cache.
Rebuilding Protobuf schema using REST, CLI, Data Grid Console or remote client might lead to inconsistencies. Remote clients might have different versions of the Protostream entity and this might lead to unreliable behavior.
Reindex all data in caches with POST
requests and the ?action=reindex
parameter.
POST /rest/v2/caches/{cacheName}/search/indexes?action=reindex
POST /rest/v2/caches/{cacheName}/search/indexes?action=reindex
Parameter | Required or Optional | Value |
---|---|---|
| OPTIONAL |
Values for the
*
* |
| OPTIONAL |
When |
2.1.34.2. Updating index schema Copy linkLink copied to clipboard!
The update index schema operation lets you add schema changes with a minimal downtime. Instead of removing previously indexed data and recreating the index schema, Data Grid adds new fields to the existing schema.
Update the index schema of values in your cache using POST
requests and the ?action=updateSchema
parameter.
POST /rest/v2/caches/{cacheName}/search/indexes?action=updateSchema
POST /rest/v2/caches/{cacheName}/search/indexes?action=updateSchema
2.1.34.3. Purging indexes Copy linkLink copied to clipboard!
Delete all indexes from caches with POST
requests and the ?action=clear
parameter.
POST /rest/v2/caches/{cacheName}/search/indexes?action=clear
POST /rest/v2/caches/{cacheName}/search/indexes?action=clear
If the operation successfully completes, the service returns 204 (No Content)
.
2.1.34.4. Get Indexes Metamodel Copy linkLink copied to clipboard!
Present the full index schema metamodel of all indexes defined on this cache.
GET /rest/v2/caches/{cacheName}/search/indexes/metamodel
GET /rest/v2/caches/{cacheName}/search/indexes/metamodel
Data Grid response
2.1.34.5. Retrieving Query and Index Statistics Copy linkLink copied to clipboard!
Obtain information about queries and indexes in caches with GET
requests.
You must enable statistics in the cache configuration or results are empty.
GET /rest/v2/caches/{cacheName}/search/stats
GET /rest/v2/caches/{cacheName}/search/stats
Parameter | Required or Optional | Value |
---|---|---|
| OPTIONAL |
Use |
Data Grid response
In the
section:
query
-
indexed_local
Provides details about indexed queries. -
indexed_distributed
Provides details about distributed indexed queries. -
hybrid
Provides details about queries that used the index only partially. -
non_indexed
Provides details about queries that didn’t use the index. -
entity_load
Provides details about cache operations to fetch objects after indexed queries execution.
Time is always measured in nanoseconds.
In the
section:
index
types
Provide details about each indexed type (class name or protobuf message) that is configured in the cache.-
count
The number of entities indexed for the type. -
size
Usage in bytes of the type.
-
-
reindexing
If the value istrue
, theIndexer
is running in the cache.
2.1.34.6. Clearing Query Statistics Copy linkLink copied to clipboard!
Reset runtime statistics with POST
requests and the ?action=clear
parameter.
POST /rest/v2/caches/{cacheName}/search/stats?action=clear
POST /rest/v2/caches/{cacheName}/search/stats?action=clear
Data Grid resets only query execution times for the local node only. This operation does not clear index statistics.
2.1.34.7. Retrieving Index Statistics (Deprecated) Copy linkLink copied to clipboard!
Obtain information about indexes in caches with GET
requests.
GET /rest/v2/caches/{cacheName}/search/indexes/stats
GET /rest/v2/caches/{cacheName}/search/indexes/stats
Data Grid response
-
indexed_class_names
Provides the class names of the indexes present in the cache. For Protobuf the value is alwaysorg.infinispan.query.remote.impl.indexing.ProtobufValueWrapper
. -
indexed_entities_count
Provides the number of entities indexed per class. -
index_sizes
Provides the size, in bytes, for each index in the cache. -
reindexing
Indicates if a re-indexing operation was performed for the cache. If the value istrue
, theMassIndexer
was started in the cache.
2.1.34.8. Retrieving Query Statistics (Deprecated) Copy linkLink copied to clipboard!
Get information about the queries that have been run in caches with GET
requests.
GET /rest/v2/caches/{cacheName}/search/query/stats
GET /rest/v2/caches/{cacheName}/search/query/stats
Data Grid response
-
search_query_execution_count
Provides the number of queries that have been run. -
search_query_total_time
Provides the total time spent on queries. -
search_query_execution_max_time
Provides the maximum time taken for a query. -
search_query_execution_avg_time
Provides the average query time. -
object_loading_total_time
Provides the total time spent loading objects from the cache after query execution. -
object_loading_execution_max_time
Provides the maximum time spent loading objects execution. -
object_loading_execution_avg_time
Provides the average time spent loading objects execution. -
objects_loaded_count
Provides the count of objects loaded. -
search_query_execution_max_time_query_string
Provides the slowest query executed.
2.1.34.9. Clearing Query Statistics (Deprecated) Copy linkLink copied to clipboard!
Reset runtime statistics with POST
requests and the ?action=clear
parameter.
POST /rest/v2/caches/{cacheName}/search/query/stats?action=clear
POST /rest/v2/caches/{cacheName}/search/query/stats?action=clear
2.1.35. Cross-Site Operations with Caches Copy linkLink copied to clipboard!
Perform cross-site replication operations with the Data Grid REST API.
2.1.35.1. Getting status of all backup locations Copy linkLink copied to clipboard!
Retrieve the status of all backup locations with GET
requests.
GET /rest/v2/caches/{cacheName}/x-site/backups/
GET /rest/v2/caches/{cacheName}/x-site/backups/
Data Grid responds with the status of each backup location in JSON format, as in the following example:
Value | Description |
---|---|
| All nodes in the local cluster have a cross-site view with the backup location. |
| No nodes in the local cluster have a cross-site view with the backup location. |
| Some nodes in the local cluster have a cross-site view with the backup location, other nodes in the local cluster do not have a cross-site view. The response indicates status for each node. |
2.1.35.2. Getting status of specific backup locations Copy linkLink copied to clipboard!
Retrieve the status of a backup location with GET
requests.
GET /rest/v2/caches/{cacheName}/x-site/backups/{siteName}
GET /rest/v2/caches/{cacheName}/x-site/backups/{siteName}
Data Grid responds with the status of each node in the site in JSON format, as in the following example:
{ "NodeA":"offline", "NodeB":"online" }
{
"NodeA":"offline",
"NodeB":"online"
}
Value | Description |
---|---|
| The node is online. |
| The node is offline. |
| Not possible to retrieve status. The remote cache could be shutting down or a network error occurred during the request. |
2.1.35.3. Taking backup locations offline Copy linkLink copied to clipboard!
Take backup locations offline with POST
requests and the ?action=take-offline
parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=take-offline
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=take-offline
2.1.35.4. Bringing backup locations online Copy linkLink copied to clipboard!
Bring backup locations online with the ?action=bring-online
parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=bring-online
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=bring-online
2.1.35.5. Pushing state to backup locations Copy linkLink copied to clipboard!
Push cache state to a backup location with the ?action=start-push-state
parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=start-push-state
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=start-push-state
2.1.35.6. Canceling state transfer Copy linkLink copied to clipboard!
Cancel state transfer operations with the ?action=cancel-push-state
parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-push-state
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-push-state
2.1.35.7. Getting state transfer status Copy linkLink copied to clipboard!
Retrieve status of state transfer operations with the ?action=push-state-status
parameter.
GET /rest/v2/caches/{cacheName}/x-site/backups?action=push-state-status
GET /rest/v2/caches/{cacheName}/x-site/backups?action=push-state-status
Data Grid responds with the status of state transfer for each backup location in JSON format, as in the following example:
{ "NYC":"CANCELED", "LON":"OK" }
{
"NYC":"CANCELED",
"LON":"OK"
}
Value | Description |
---|---|
| State transfer to the backup location is in progress. |
| State transfer completed successfully. |
| An error occurred with state transfer. Check log files. |
| State transfer cancellation is in progress. |
2.1.35.8. Clearing state transfer status Copy linkLink copied to clipboard!
Clear state transfer status for sending sites with the ?action=clear-push-state-status
parameter.
POST /rest/v2/caches/{cacheName}/x-site/local?action=clear-push-state-status
POST /rest/v2/caches/{cacheName}/x-site/local?action=clear-push-state-status
2.1.35.9. Modifying take offline conditions Copy linkLink copied to clipboard!
Sites go offline if certain conditions are met. Modify the take offline parameters to control when backup locations automatically go offline.
Procedure
Check configured take offline parameters with
GET
requests and thetake-offline-config
parameter.GET /rest/v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-config
GET /rest/v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The Data Grid response includes
after_failures
andmin_wait
fields as follows:{ "after_failures": 2, "min_wait": 1000 }
{ "after_failures": 2, "min_wait": 1000 }
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Modify take offline parameters in the body of
PUT
requests.PUT /rest/v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-config
PUT /rest/v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the operation successfully completes, the service returns
204 (No Content)
.
2.1.35.10. Canceling state transfer from receiving sites Copy linkLink copied to clipboard!
If the connection between two backup locations breaks, you can cancel state transfer on the site that is receiving the push.
Cancel state transfer from a remote site and keep the current state of the local cache with the ?action=cancel-receive-state
parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-receive-state
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-receive-state
2.1.36. Rolling Upgrades Copy linkLink copied to clipboard!
Perform rolling upgrades of cache data between Data Grid clusters
2.1.36.1. Connecting Source Clusters Copy linkLink copied to clipboard!
Connect a target cluster to the source cluster with:
POST /rest/v2/caches/{cacheName}/rolling-upgrade/source-connection
POST /rest/v2/caches/{cacheName}/rolling-upgrade/source-connection
You must provide a remote-store
definition in JSON format as the body:
JSON
Several elements are optional such as security
, async-executor
and connection-pool
. The configuration must contain minimally the cache name, the raw-values
set to false
and the host/ip of the single port in the source cluster. For details about the remote-store
configuration, consult the XSD Schema.
If the operation successfully completes, the service returns 204 (No Content). If the target cluster is already connected to the source cluster, it returns status 304 (Not Modified).
2.1.36.2. Obtaining Source Cluster connection details Copy linkLink copied to clipboard!
To obtain the remote-store
definition of a cache, use a GET
request:
GET /rest/v2/caches/{cacheName}/rolling-upgrade/source-connection
GET /rest/v2/caches/{cacheName}/rolling-upgrade/source-connection
If the cache was previously connected, it returns the configuration of the associated remote-store
in JSON format and status 200 (OK), otherwise a 404 (Not Found) status.
This is not a cluster wide operation, and it only returns the remote-store of the cache in the node where the REST invocation is handled.
2.1.36.3. Checking if a Cache is connected Copy linkLink copied to clipboard!
To check if a cache have been connected to a remote cluster, use a HEAD
request:
HEAD /rest/v2/caches/{cacheName}/rolling-upgrade/source-connection
HEAD /rest/v2/caches/{cacheName}/rolling-upgrade/source-connection
Returns status 200 (OK) if for all nodes of the cluster, cacheName
has a single remote store configured, and 404 (NOT_FOUND) otherwise.
2.1.36.4. Synchronizing Data Copy linkLink copied to clipboard!
Synchronize data from a source cluster to a target cluster with POST
requests and the ?action=sync-data
parameter:
POST /rest/v2/caches/{cacheName}?action=sync-data
POST /rest/v2/caches/{cacheName}?action=sync-data
When the operation completes, Data Grid responds with the total number of entries copied to the target cluster.
2.1.36.5. Disconnecting Source Clusters Copy linkLink copied to clipboard!
After you synchronize data to target clusters, disconnect from the source cluster with DELETE
requests:
DELETE /rest/v2/caches/{cacheName}/rolling-upgrade/source-connection
DELETE /rest/v2/caches/{cacheName}/rolling-upgrade/source-connection
If the operation successfully completes, the service returns 204 (No Content)
. It no source was connected, it returns code 304 (Not Modified).
2.2. Creating and Managing Counters Copy linkLink copied to clipboard!
Create, delete, and modify counters via the REST API.
2.2.1. Creating Counters Copy linkLink copied to clipboard!
Create counters with POST
requests that include configuration in the payload.
POST /rest/v2/counters/{counterName}
POST /rest/v2/counters/{counterName}
Example Weak Counter
Example Strong Counter
2.2.2. Deleting Counters Copy linkLink copied to clipboard!
Remove specific counters with DELETE
requests.
DELETE /rest/v2/counters/{counterName}
DELETE /rest/v2/counters/{counterName}
2.2.3. Retrieving Counter Configuration Copy linkLink copied to clipboard!
Retrieve configuration for specific counters with GET
requests.
GET /rest/v2/counters/{counterName}/config
GET /rest/v2/counters/{counterName}/config
Data Grid responds with the counter configuration in JSON format.
2.2.4. Getting Counter Values Copy linkLink copied to clipboard!
Retrieve counter values with GET
requests.
GET /rest/v2/counters/{counterName}
GET /rest/v2/counters/{counterName}
Header | Required or Optional | Parameter |
---|---|---|
OPTIONAL | The required format to return the content. Supported formats are application/json and text/plain. JSON is assumed if no header is provided. |
2.2.5. Resetting Counters Copy linkLink copied to clipboard!
Restore the initial value of counters without POST
requests and the ?action=reset
parameter.
POST /rest/v2/counters/{counterName}?action=reset
POST /rest/v2/counters/{counterName}?action=reset
If the operation successfully completes, the service returns 204 (No Content)
.
2.2.6. Incrementing Counters Copy linkLink copied to clipboard!
Increment counter values with POST
request` and the ?action=increment
parameter.
POST /rest/v2/counters/{counterName}?action=increment
POST /rest/v2/counters/{counterName}?action=increment
WEAK
counters never respond after operations and return 204 (No Content)
.
STRONG
counters return 200 (OK)
and the current value after each operation.
2.2.7. Adding Deltas to Counters Copy linkLink copied to clipboard!
Add arbitrary values to counters with POST
requests that include the ?action=add
and delta
parameters.
POST /rest/v2/counters/{counterName}?action=add&delta={delta}
POST /rest/v2/counters/{counterName}?action=add&delta={delta}
WEAK
counters never respond after operations and return 204 (No Content)
.
STRONG
counters return 200 (OK)
and the current value after each operation.
2.2.8. Decrementing Counter Values Copy linkLink copied to clipboard!
Decrement counter values with POST
requests and the ?action=decrement
parameter.
POST /rest/v2/counters/{counterName}?action=decrement
POST /rest/v2/counters/{counterName}?action=decrement
WEAK
counters never respond after operations and return 204 (No Content)
.
STRONG
counters return 200 (OK)
and the current value after each operation.
2.2.9. Performing getAndSet atomic operations on Strong Counters Copy linkLink copied to clipboard!
Atomically set values for strong counters with POST
requests and the getAndSet
parameter.
POST /rest/v2/counters/{counterName}?action=getAndSet&value={value}
POST /rest/v2/counters/{counterName}?action=getAndSet&value={value}
If the operation is successful, Data Grid returns the previous value in the payload.
2.2.10. Performing compareAndSet Operations on Strong Counters Copy linkLink copied to clipboard!
Atomically set values for strong counters with GET
requests and the compareAndSet
parameter.
POST /rest/v2/counters/{counterName}?action=compareAndSet&expect={expect}&update={update}
POST /rest/v2/counters/{counterName}?action=compareAndSet&expect={expect}&update={update}
Data Grid atomically sets the value to {update}
if the current value is {expect}
. If the operation is successful, Data Grid returns true
.
2.2.11. Performing compareAndSwap Operations on Strong Counters Copy linkLink copied to clipboard!
Atomically set values for strong counters with GET
requests and the compareAndSwap
parameter.
POST /rest/v2/counters/{counterName}?action=compareAndSwap&expect={expect}&update={update}
POST /rest/v2/counters/{counterName}?action=compareAndSwap&expect={expect}&update={update}
Data Grid atomically sets the value to {update}
if the current value is {expect}
. If the operation is successful, Data Grid returns the previous value in the payload.
2.2.12. Listing Counters Copy linkLink copied to clipboard!
Retrieve a list of counters in Data Grid clusters with GET
requests.
GET /rest/v2/counters/
GET /rest/v2/counters/
2.3. Working with Protobuf Schemas Copy linkLink copied to clipboard!
Create and manage Protobuf schemas, .proto
files, via the Data Grid REST API.
2.3.1. Creating Protobuf Schemas Copy linkLink copied to clipboard!
Create Protobuf schemas across Data Grid clusters with POST
requests that include the content of a protobuf file in the payload.
POST /rest/v2/schemas/{schemaName}
POST /rest/v2/schemas/{schemaName}
If the schema already exists, Data Grid returns HTTP 409 (Conflict)
. If the schema is not valid, either because of syntax errors, or because some of its dependencies are missing, Data Grid stores the schema and returns the error in the response body.
Data Grid responds with the schema name and any errors.
-
name
is the name of the Protobuf schema. -
error
isnull
for valid Protobuf schemas. If Data Grid cannot successfully validate the schema, it returns errors.
If the operation successfully completes, the service returns 201 (Created)
.
2.3.2. Reading Protobuf Schemas Copy linkLink copied to clipboard!
Retrieve Protobuf schema from Data Grid with GET
requests.
GET /rest/v2/schemas/{schemaName}
GET /rest/v2/schemas/{schemaName}
2.3.3. Updating Protobuf Schemas Copy linkLink copied to clipboard!
Modify Protobuf schemas with PUT
requests that include the content of a protobuf file in the payload.
When you make changes to the existing Protobuf schema definition, you must either update or rebuild the index schema. If the changes involve modifying the existing fields, then you must rebuild the index. When you add new fields without touching existing schema, you can update the index schema instead of rebuilding it.
PUT /rest/v2/schemas/{schemaName}
PUT /rest/v2/schemas/{schemaName}
If the schema is not valid, either because of syntax errors, or because some of its dependencies are missing, Data Grid updates the schema and returns the error in the response body.
-
name
is the name of the Protobuf schema. -
error
isnull
for valid Protobuf schemas. If Data Grid cannot successfully validate the schema, it returns errors.
2.3.4. Deleting Protobuf Schemas Copy linkLink copied to clipboard!
Remove Protobuf schemas from Data Grid clusters with DELETE
requests.
DELETE /rest/v2/schemas/{schemaName}
DELETE /rest/v2/schemas/{schemaName}
If the operation successfully completes, the service returns 204 (No Content)
.
2.3.5. Listing Protobuf Schemas Copy linkLink copied to clipboard!
List all available Protobuf schemas with GET
requests.
GET /rest/v2/schemas/
GET /rest/v2/schemas/
Data Grid responds with a list of all schemas available on the cluster.
-
name
is the name of the Protobuf schema. -
error
isnull
for valid Protobuf schemas. If Data Grid cannot successfully validate the schema, it returns errors.
2.3.6. Listing Protobuf Types Copy linkLink copied to clipboard!
List all available Protobuf types with GET
requests.
GET /rest/v2/schemas?action=types
GET /rest/v2/schemas?action=types
Data Grid responds with a list of all types available on the cluster.
["org.infinispan.Person", "org.infinispan.Phone"]
["org.infinispan.Person", "org.infinispan.Phone"]
2.4. Working with Cache Managers Copy linkLink copied to clipboard!
Interact with Data Grid Cache Managers to get cluster and usage statistics.
2.4.1. Getting Basic Container Information Copy linkLink copied to clipboard!
Retrieving information about the cache manager with GET
requests.
GET /rest/v2/container
GET /rest/v2/container
Data Grid responds with information in JSON format, as in the following example:
Information about caches with security authorization is available only to users with the specific roles and permissions assigned to them.
-
version
contains the Data Grid version -
name
contains the name of the Cache Manager as defined in the configuration -
coordinator
is true if the Cache Manager is the coordinator of the cluster -
cache_configuration_names
contains an array of all caches configurations defined in the Cache Manager that are accessible to the current user -
cluster_name
contains the name of the cluster as defined in the configuration -
physical_addresses
contains the physical network addresses associated with the Cache Manager -
coordinator_address
contains the physical network addresses of the coordinator of the cluster -
cache_manager_status
the lifecycle status of the Cache Manager. For possible values, check theorg.infinispan.lifecycle.ComponentStatus
documentation -
created_cache_count
number of created caches, excludes all internal and private caches -
running_cache_count
number of created caches that are running -
node_address
contains the logical address of the Cache Manager -
cluster_members
andcluster_members_physical_addresses
an array of logical and physical addresses of the members of the cluster -
cluster_size
number of members in the cluster -
defined_caches
A list of all caches defined in the Cache Manager, excluding private caches but including internal caches that are accessible -
local_site
The name of the local site.
If cross-site replication is not configured, Data Grid returns "local". -
relay_node
is true if the node handles RELAY messages between clusters. -
relay_nodes_address
is an array of logical addresses for relay nodes. -
sites_view
The list of sites that participate in cross-site replication.
If cross-site replication is not configured, Data Grid returns an empty list. -
rebalancing_enabled
is true if rebalancing is enabled. Fetching this property might fail on the server. In that case the property won’t be present in the payload.
2.4.2. Getting Cluster Health Copy linkLink copied to clipboard!
Retrieve health information for Data Grid clusters with GET
requests.
GET /rest/v2/container/health
GET /rest/v2/container/health
Data Grid responds with cluster health information in JSON format, as in the following example:
cluster_health
contains the health of the cluster-
cluster_name
specifies the name of the cluster as defined in the configuration. health_status
provides one of the following:-
DEGRADED
indicates at least one of the caches is in degraded mode. -
HEALTHY_REBALANCING
indicates at least one cache is in the rebalancing state. -
HEALTHY
indicates all cache instances in the cluster are operating as expected. -
FAILED
indicates the cache failed to start with the provided configuration.
-
-
number_of_nodes
displays the total number of cluster members. Returns a value of0
for non-clustered (standalone) servers. -
node_names
is an array of all cluster members. Empty for standalone servers.
-
cache_health
contains health information per-cache-
status
HEALTHY, DEGRADED, HEALTHY_REBALANCING or FAILED -
cache_name
the name of the cache as defined in the configuration.
-
2.4.3. Getting Container Health Status Copy linkLink copied to clipboard!
Retrieve the health status of the Data Grid container with GET
requests that do not require authentication.
GET /rest/v2/container/health/status
GET /rest/v2/container/health/status
Data Grid responds with one of the following in text/plain
format:
-
HEALTHY
-
HEALTHY_REBALANCING
-
DEGRADED
-
FAILED
2.4.4. Checking REST Endpoint Availability Copy linkLink copied to clipboard!
Verify Data Grid server REST endpoint availability with HEAD
requests.
HEAD /rest/v2/container/health
HEAD /rest/v2/container/health
If you receive a successful response code then the Data Grid REST server is running and serving requests.
2.4.5. Obtaining Global Configuration Copy linkLink copied to clipboard!
Retrieve global configuration for the data container with GET
requests.
GET /rest/v2/container/config
GET /rest/v2/container/config
Header | Required or Optional | Parameter |
---|---|---|
OPTIONAL | The required format to return the content. Supported formats are application/json and application/xml. JSON is assumed if no header is provided. |
Parameter | Required or Optional | Description |
---|---|---|
| OPTIONAL |
If |
Reference
2.4.6. Obtaining Configuration for All Caches Copy linkLink copied to clipboard!
Retrieve the configuration for all caches with GET
requests.
GET /rest/v2/container/cache-configs
GET /rest/v2/container/cache-configs
Data Grid responds with JSON
arrays that contain each cache and cache configuration, as in the following example:
Parameter | Required or Optional | Description |
---|---|---|
| OPTIONAL |
If |
2.4.7. Listing Available Cache Templates Copy linkLink copied to clipboard!
Retrieve all available Data Grid cache templates with GET
requests.
GET /rest/v2/cache-configs/templates
GET /rest/v2/cache-configs/templates
Parameter | Required or Optional | Description |
---|---|---|
| OPTIONAL |
If |
2.4.8. Getting Container Statistics Copy linkLink copied to clipboard!
Retrieve the statistics of the container with GET
requests.
GET /rest/v2/container/stats
GET /rest/v2/container/stats
Data Grid responds with Cache Manager statistics in JSON format, as in the following example:
-
statistics_enabled
istrue
if statistics collection is enabled for the Cache Manager. -
read_write_ratio
displays the read/write ratio across all caches. -
time_since_start
shows the time, in seconds, since the Cache Manager started. -
time_since_reset
shows the number of seconds since the Cache Manager statistics were last reset. -
number_of_entries
shows the total number of entries currently in all caches from the Cache Manager. This statistic returns entries in the local cache instances only. -
off_heap_memory_used
shows the amount, inbytes[]
, of off-heap memory used by this cache container. -
data_memory_used
shows the amount, inbytes[]
, that the current eviction algorithm estimates is in use for data across all caches. Returns0
if eviction is not enabled. -
misses
shows the number ofget()
misses across all caches. -
remove_hits
shows the number of removal hits across all caches. -
remove_misses
shows the number of removal misses across all caches. -
evictions
shows the number of evictions across all caches. -
average_read_time
shows the average number of milliseconds taken forget()
operations across all caches. -
average_read_time_nanos
same asaverage_read_time
but in nanoseconds. -
average_remove_time
shows the average number of milliseconds forremove()
operations across all caches. -
average_remove_time_nanos
same asaverage_remove_time
but in nanoseconds. -
required_minimum_number_of_nodes
shows the required minimum number of nodes to guarantee data consistency. -
hits
provides the number ofget()
hits across all caches. -
stores
provides the number ofput()
operations across all caches. -
current_number_of_entries_in_memory
shows the total number of entries currently in all caches, excluding passivated entries. -
hit_ratio
provides the total percentage hit/(hit+miss) ratio for all caches. -
retrievals
shows the total number ofget()
operations.
2.4.9. Resetting Container Statistics Copy linkLink copied to clipboard!
Reset the statistics with POST
requests.
POST /rest/v2/container/stats?action=reset
POST /rest/v2/container/stats?action=reset
2.4.10. Shutdown all container caches Copy linkLink copied to clipboard!
Shut down the Data Grid container on the server with POST
requests.
POST /rest/v2/container?action=shutdown
POST /rest/v2/container?action=shutdown
Data Grid responds with 204 (No Content)
and then shutdowns all caches in the container. The servers remain running with active endpoints and clustering, however REST calls to container resources will result in a 503 Service Unavailable response.
This method is primarily intended for use by the Data Grid Operator. The expectation is that the Server processes will be manually terminated shortly after this endpoint is invoked. Once this method has been called, it’s not possible to restart the container state.
2.4.11. Enabling rebalancing for all caches Copy linkLink copied to clipboard!
Turn on automatic rebalancing for all caches.
POST /rest/v2/container?action=enable-rebalancing
POST /rest/v2/container?action=enable-rebalancing
2.4.12. Disabling rebalancing for all caches Copy linkLink copied to clipboard!
Turn off automatic rebalancing for all caches.
POST /rest/v2/container?action=disable-rebalancing
POST /rest/v2/container?action=disable-rebalancing
2.4.13. Backing Up Data Grid Copy linkLink copied to clipboard!
Create backup archives, application/zip
, that contain resources (caches, cache templates, counters, Protobuf schemas, server tasks, and so on) currently stored in the Data Grid
POST /rest/v2/container/backups/{backupName}
POST /rest/v2/container/backups/{backupName}
If a backup with the same name already exists, the service responds with 409 (Conflict)
. If the directory
parameter is not valid, the service returns 400 (Bad Request)
. A 202
response indicates that the backup request is accepted for processing.
Optionally include a JSON payload with your request that contains parameters for the backup operation, as follows:
Key | Required or Optional | Value |
---|---|---|
| OPTIONAL | Specifies a location on the server to create and store the backup archive. |
| OPTIONAL | Specifies the resources to back up, in JSON format. The default is to back up all resources. If you specify one or more resources, then Data Grid backs up only those resources. See the Resource Parameters table for more information. |
Key | Required or Optional | Value |
---|---|---|
| OPTIONAL |
Specifies either an array of cache names to back up or |
| OPTIONAL |
Specifies either an array of cache templates to back up or |
| OPTIONAL |
Defines either an array of counter names to back up or |
| OPTIONAL |
Defines either an array of Protobuf schema names to back up or |
| OPTIONAL |
Specifies either an array of server tasks to back up or |
The following example creates a backup archive with all counters and caches named [cache1,cache2]
in a specified directory:
2.4.14. Listing Backups Copy linkLink copied to clipboard!
Retrieve the names of all backup operations that are in progress, completed, or failed.
GET /rest/v2/container/backups
GET /rest/v2/container/backups
Data Grid responds with an Array of all backup names as in the following example:
["backup1", "backup2"]
["backup1", "backup2"]
2.4.15. Checking Backup Availability Copy linkLink copied to clipboard!
Verify that a backup operation is complete.
HEAD /rest/v2/container/backups/{backupName}
HEAD /rest/v2/container/backups/{backupName}
A 200
response indicates the backup archive is available. A 202
response indicates the backup operation is in progress.
2.4.16. Downloading Backup Archives Copy linkLink copied to clipboard!
Download backup archives from the server.
GET /rest/v2/container/backups/{backupName}
GET /rest/v2/container/backups/{backupName}
A 200
response indicates the backup archive is available. A 202
response indicates the backup operation is in progress.
2.4.17. Deleting Backup Archives Copy linkLink copied to clipboard!
Remove backup archives from the server.
DELETE /rest/v2/container/backups/{backupName}
DELETE /rest/v2/container/backups/{backupName}
A 204
response indicates that the backup archive is deleted. A 202
response indicates that the backup operation is in progress but will be deleted when the operation completes.
2.4.18. Restoring Data Grid Resources from Backup Archives Copy linkLink copied to clipboard!
Restore Data Grid resources from backup archives. The provided {restoreName}
is for tracking restore progress, and is independent of the name of backup file being restored.
POST /rest/v2/container/restores/{restoreName}
POST /rest/v2/container/restores/{restoreName}
A 202
response indicates that the restore request has been accepted for processing.
2.4.18.1. Restoring from Backup Archives on Data Grid Server Copy linkLink copied to clipboard!
Use the application/json
content type with your POST request to back up from an archive that is available on the server.
Key | Required or Optional | Value |
---|---|---|
| REQUIRED | Specifies the path of the backup archive to restore. |
| OPTIONAL | Specifies the resources to restore, in JSON format. The default is to restore all resources. If you specify one or more resources, then Data Grid restores only those resources. See the Resource Parameters table for more information. |
Key | Required or Optional | Value |
---|---|---|
| OPTIONAL |
Specifies either an array of cache names to back up or |
| OPTIONAL |
Specifies either an array of cache templates to back up or |
| OPTIONAL |
Defines either an array of counter names to back up or |
| OPTIONAL |
Defines either an array of Protobuf schema names to back up or |
| OPTIONAL |
Specifies either an array of server tasks to back up or |
The following example restores all counters from a backup archive on the server:
2.4.18.2. Restoring from Local Backup Archives Copy linkLink copied to clipboard!
Use the multipart/form-data
content type with your POST request to upload a local backup archive to the server.
Parameter | Content-Type | Required or Optional | Value |
---|---|---|---|
|
| REQUIRED | Specifies the bytes of the backup archive to restore. |
|
| OPTIONAL | Defines a JSON object of request parameters. |
Example Request
2.4.19. Listing Restores Copy linkLink copied to clipboard!
Retrieve the names of all restore requests that are in progress, completed, or failed.
GET /rest/v2/container/restores
GET /rest/v2/container/restores
Data Grid responds with an Array of all restore names as in the following example:
["restore1", "restore2"]
["restore1", "restore2"]
2.4.20. Checking Restore Progress Copy linkLink copied to clipboard!
Verify that a restore operation is complete.
HEAD /rest/v2/container/restores/{restoreName}
HEAD /rest/v2/container/restores/{restoreName}
A 201 (Created)
response indicates the restore operation is completed. A 202 (Accepted)
response indicates the backup operation is in progress.
2.4.21. Deleting Restore Metadata Copy linkLink copied to clipboard!
Remove metadata for restore requests from the server. This action removes all metadata associated with restore requests but does not delete any restored content. If you delete the request metadata, you can use the request name to perform subsequent restore operations.
DELETE /rest/v2/container/restores/{restoreName}
DELETE /rest/v2/container/restores/{restoreName}
A 204 (No Content)
response indicates that the restore metadata is deleted. A 202 (Accepted)
response indicates that the restore operation is in progress and will be deleted when the operation completes.
2.4.22. Listening to container configuration events Copy linkLink copied to clipboard!
Receive events about configuration changes using Server-Sent Events. The event
value will be one of create-cache
, remove-cache
, update-cache
, create-template
, remove-template
or update-template
. The data
value will contain the declarative configuration of the entity that has been created. Remove events will only contain the name of the removed entity.
GET /rest/v2/container/config?action=listen
GET /rest/v2/container/config?action=listen
Header | Required or Optional | Parameter |
---|---|---|
| OPTIONAL |
Sets the required format to return content. Supported formats are |
Parameter | Required or Optional | Description |
---|---|---|
| OPTIONAL |
If |
| OPTIONAL |
If |
2.4.23. Listening to container events Copy linkLink copied to clipboard!
Receive events from the container using Server-Sent Events. The emitted events come from logged information, so each event contains an identifier associated with the message. The event
value will be lifecycle-event
. The data
has the logged information, which includes the message
, category
, level
, timestamp
, owner
, context
, and scope
, some of which may be empty. Currently, we expose only LIFECYCLE
events.
GET /rest/v2/container?action=listen
GET /rest/v2/container?action=listen
Header | Required or Optional | Parameter |
---|---|---|
| OPTIONAL |
Sets the required format to return content. Supported formats are |
Parameter | Required or Optional | Description |
---|---|---|
| OPTIONAL |
If |
| OPTIONAL |
If |
2.4.24. Cross-Site Operations with Cache Managers Copy linkLink copied to clipboard!
Perform cross-site operations with Cache Managers to apply the operations to all caches.
2.4.24.1. Getting status of backup locations Copy linkLink copied to clipboard!
Retrieve the status of all backup locations with GET
requests.
GET /rest/v2/container/x-site/backups/
GET /rest/v2/container/x-site/backups/
Data Grid responds with status in JSON format, as in the following example:
Value | Description |
---|---|
| All nodes in the local cluster have a cross-site view with the backup location. |
| No nodes in the local cluster have a cross-site view with the backup location. |
| Some nodes in the local cluster have a cross-site view with the backup location, other nodes in the local cluster do not have a cross-site view. The response indicates status for each node. |
GET /rest/v2/container/x-site/backups/{site}
GET /rest/v2/container/x-site/backups/{site}
Returns the status for a single backup location.
2.4.24.2. Taking backup locations offline Copy linkLink copied to clipboard!
Take backup locations offline with the ?action=take-offline
parameter.
POST /rest/v2/container/x-site/backups/{siteName}?action=take-offline
POST /rest/v2/container/x-site/backups/{siteName}?action=take-offline
2.4.24.3. Bringing backup locations online Copy linkLink copied to clipboard!
Bring backup locations online with the ?action=bring-online
parameter.
POST /rest/v2/container/x-site/backups/{siteName}?action=bring-online
POST /rest/v2/container/x-site/backups/{siteName}?action=bring-online
2.4.24.4. Retrieving the state transfer mode Copy linkLink copied to clipboard!
Check the state transfer mode with GET
requests.
GET /rest/v2/caches/{cacheName}/x-site/backups/{site}/state-transfer-mode
GET /rest/v2/caches/{cacheName}/x-site/backups/{site}/state-transfer-mode
2.4.24.5. Setting the state transfer mode Copy linkLink copied to clipboard!
Configure the state transfer mode with the ?action=set
parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{site}/state-transfer-mode?action=set&mode={mode}
POST /rest/v2/caches/{cacheName}/x-site/backups/{site}/state-transfer-mode?action=set&mode={mode}
2.4.24.6. Starting state transfer Copy linkLink copied to clipboard!
Push state of all caches to remote sites with the ?action=start-push-state
parameter.
POST /rest/v2/container/x-site/backups/{siteName}?action=start-push-state
POST /rest/v2/container/x-site/backups/{siteName}?action=start-push-state
2.4.24.7. Canceling state transfer Copy linkLink copied to clipboard!
Cancel ongoing state transfer operations with the ?action=cancel-push-state
parameter.
POST /rest/v2/container/x-site/backups/{siteName}?action=cancel-push-state
POST /rest/v2/container/x-site/backups/{siteName}?action=cancel-push-state
2.5. Working with Data Grid Servers Copy linkLink copied to clipboard!
Monitor and manage Data Grid server instances.
2.5.1. Retrieving Basic Server Information Copy linkLink copied to clipboard!
View basic information about Data Grid Servers with GET
requests.
GET /rest/v2/server
GET /rest/v2/server
Data Grid responds with the server name, codename, and version in JSON format as in the following example:
{ "version":"Infinispan 'Codename' xx.x.x.Final" }
{
"version":"Infinispan 'Codename' xx.x.x.Final"
}
2.5.2. Getting Cache Managers Copy linkLink copied to clipboard!
Retrieve lists of Cache Managers for Data Grid Servers with GET
requests.
GET /rest/v2/server/cache-managers
GET /rest/v2/server/cache-managers
Data Grid responds with an array of the Cache Manager names configured for the server.
Data Grid currently supports one Cache Manager per server only.
2.5.3. Adding Caches to Ignore Lists Copy linkLink copied to clipboard!
Configure Data Grid to temporarily exclude specific caches from client requests. Send empty POST
requests that include the names of the Cache Manager name and the cache.
POST /rest/v2/server/ignored-caches/{cache}
POST /rest/v2/server/ignored-caches/{cache}
Data Grid responds with 204 (No Content)
if the cache is successfully added to the ignore list or 404 (Not Found)
if the cache or Cache Manager are not found.
Data Grid currently supports one Cache Manager per server only. For future compatibility you must provide the Cache Manager name in the requests.
2.5.4. Removing Caches from Ignore Lists Copy linkLink copied to clipboard!
Remove caches from the ignore list with DELETE
requests.
DELETE /rest/v2/server/ignored-caches/{cache}
DELETE /rest/v2/server/ignored-caches/{cache}
Data Grid responds with 204 (No Content)
if the cache is successfully removed from ignore list or 404 (Not Found)
if the cache or Cache Manager are not found.
2.5.5. Confirming Ignored Caches Copy linkLink copied to clipboard!
Confirm that caches are ignored with GET
requests.
GET /rest/v2/server/ignored-caches/
GET /rest/v2/server/ignored-caches/
2.5.6. Obtaining Server Configuration Copy linkLink copied to clipboard!
Retrieve Data Grid Server configurations with GET
requests.
GET /rest/v2/server/config
GET /rest/v2/server/config
Data Grid responds with the configuration in JSON format, as follows:
2.5.7. Getting Environment Variables Copy linkLink copied to clipboard!
Retrieve all environment variables for Data Grid Servers with GET
requests.
GET /rest/v2/server/env
GET /rest/v2/server/env
2.5.8. Getting JVM Memory Details Copy linkLink copied to clipboard!
Retrieve JVM memory usage information for Data Grid Servers with GET
requests.
GET /rest/v2/server/memory
GET /rest/v2/server/memory
Data Grid responds with heap and non-heap memory statistics, direct memory usage, and information about memory pools and garbage collection in JSON format.
2.5.9. Getting JVM Heap Dumps Copy linkLink copied to clipboard!
Generate JVM heap dumps for Data Grid Servers with POST
requests.
POST /rest/v2/server/memory?action=heap-dump[&live=true|false]
POST /rest/v2/server/memory?action=heap-dump[&live=true|false]
Data Grid generates a heap dump file in HPROF format in the server data directory and responds with the full path of the file in JSON format.
2.5.10. Getting JVM Thread Dumps Copy linkLink copied to clipboard!
Retrieve the current thread dump for the JVM with GET
requests.
GET /rest/v2/server/threads
GET /rest/v2/server/threads
Data Grid responds with the current thread dump in text/plain
format.
2.5.11. Getting Diagnostic Reports for Data Grid Servers Copy linkLink copied to clipboard!
Retrieve aggregated reports for Data Grid Servers with GET
requests. To retrieve the report for the requested server:
GET /rest/v2/server/report
GET /rest/v2/server/report
To retrieve the report of another server in the cluster, reference the node by name:
GET /rest/v2/server/report/{nodeName}
GET /rest/v2/server/report/{nodeName}
Data Grid responds with a tar.gz
archive that contains an aggregated report with diagnostic information about both the Data Grid Server and the host. The report provides details about CPU, memory, open files, network sockets and routing, threads, in addition to configuration and log files.
2.5.12. Stopping Data Grid Servers Copy linkLink copied to clipboard!
Stop Data Grid Servers with POST
requests.
POST /rest/v2/server?action=stop
POST /rest/v2/server?action=stop
Data Grid responds with 204 (No Content)
and then stops running.
2.5.13. Retrieving Client Connection Information Copy linkLink copied to clipboard!
List information about clients connected to Data Grid Servers with GET
requests.
GET /rest/v2/server/connections
GET /rest/v2/server/connections
Data Grid responds with details about all active client connections in JSON format as in the following example:
Parameter | Required or Optional | Value |
---|---|---|
| OPTIONAL |
|
2.5.14. Retrieving Default values for Cache Configuration Copy linkLink copied to clipboard!
Retrieve default values for cache configuration with GET
requests.
POST /rest/v2/server/caches/defaults
POST /rest/v2/server/caches/defaults
Data Grid responds with the default values for cache configuration in JSON format.
2.6. Working with Data Grid Clusters Copy linkLink copied to clipboard!
Monitor and perform administrative tasks on Data Grid clusters.
2.6.1. Stopping Data Grid Clusters Copy linkLink copied to clipboard!
Shut down entire Data Grid clusters with POST
requests.
POST /rest/v2/cluster?action=stop
POST /rest/v2/cluster?action=stop
Data Grid responds with 204 (No Content)
and then performs an orderly shutdown of the entire cluster.
2.6.2. Stopping Specific Data Grid Servers in Clusters Copy linkLink copied to clipboard!
Shut down one or more specific servers in Data Grid clusters with GET
requests and the ?action=stop&server
parameter.
POST /rest/v2/cluster?action=stop&server={server1_host}&server={server2_host}
POST /rest/v2/cluster?action=stop&server={server1_host}&server={server2_host}
Data Grid responds with 204 (No Content)
.
2.6.3. Backing Up Data Grid Clusters Copy linkLink copied to clipboard!
Create backup archives, application/zip
, that contain resources (caches, templates, counters, Protobuf schemas, server tasks, and so on) currently stored in the cache container for the cluster.
POST /rest/v2/cluster/backups/{backupName}
POST /rest/v2/cluster/backups/{backupName}
Optionally include a JSON payload with your request that contains parameters for the backup operation, as follows:
Key | Required or Optional | Value |
---|---|---|
| OPTIONAL | Specifies a location on the server to create and store the backup archive. |
If the backup operation successfully completes, the service returns 202 (Accepted)
. If a backup with the same name already exists, the service returns 409 (Conflict)
. If the directory
parameter is not valid, the service returns 400 (Bad Request)
.
2.6.4. Listing Backups Copy linkLink copied to clipboard!
Retrieve the names of all backup operations that are in progress, completed, or failed.
GET /rest/v2/cluster/backups
GET /rest/v2/cluster/backups
Data Grid responds with an Array of all backup names as in the following example:
["backup1", "backup2"]
["backup1", "backup2"]
2.6.5. Checking Backup Availability Copy linkLink copied to clipboard!
Verify that a backup operation is complete. A 200
response indicates the backup archive is available. A 202
response indicates the backup operation is in progress.
HEAD /rest/v2/cluster/backups/{backupName}
HEAD /rest/v2/cluster/backups/{backupName}
2.6.6. Downloading Backup Archives Copy linkLink copied to clipboard!
Download backup archives from the server. A 200
response indicates the backup archive is available. A 202
response indicates the backup operation is in progress.
GET /rest/v2/cluster/backups/{backupName}
GET /rest/v2/cluster/backups/{backupName}
2.6.7. Deleting Backup Archives Copy linkLink copied to clipboard!
Remove backup archives from the server. A 204
response indicates that the backup archive is deleted. A 202
response indicates that the backup operation is in progress but will be deleted when the operation completes.
DELETE /rest/v2/cluster/backups/{backupName}
DELETE /rest/v2/cluster/backups/{backupName}
2.6.8. Restoring Data Grid Cluster Resources Copy linkLink copied to clipboard!
Apply resources in a backup archive to restore Data Grid clusters. The provided {restoreName}
is for tracking restore progress, and is independent of the name of backup file being restored.
You can restore resources only if the container name in the backup archive matches the container name for the cluster.
POST /rest/v2/cluster/restores/{restoreName}
POST /rest/v2/cluster/restores/{restoreName}
A 202
response indicates that the restore request is accepted for processing.
2.6.8.1. Restoring from Backup Archives on Data Grid Server Copy linkLink copied to clipboard!
Use the application/json
content type with your POST request to back up from an archive that is available on the server.
Key | Required or Optional | Value |
---|---|---|
| REQUIRED | Specifies the path of the backup archive to restore. |
| OPTIONAL | Specifies the resources to restore, in JSON format. The default is to restore all resources. If you specify one or more resources, then Data Grid restores only those resources. See the Resource Parameters table for more information. |
Key | Required or Optional | Value |
---|---|---|
| OPTIONAL |
Specifies either an array of cache names to back up or |
| OPTIONAL |
Specifies either an array of cache templates to back up or |
| OPTIONAL |
Defines either an array of counter names to back up or |
| OPTIONAL |
Defines either an array of Protobuf schema names to back up or |
| OPTIONAL |
Specifies either an array of server tasks to back up or |
The following example restores all counters from a backup archive on the server:
2.6.8.2. Restoring from Local Backup Archives Copy linkLink copied to clipboard!
Use the multipart/form-data
content type with your POST request to upload a local backup archive to the server.
Parameter | Content-Type | Required or Optional | Value |
---|---|---|---|
|
| REQUIRED | Specifies the bytes of the backup archive to restore. |
Example Request
2.6.9. Listing Restores Copy linkLink copied to clipboard!
Retrieve the names of all restore requests that are in progress, completed, or failed.
GET /rest/v2/cluster/restores
GET /rest/v2/cluster/restores
Data Grid responds with an Array of all restore names as in the following example:
["restore1", "restore2"]
["restore1", "restore2"]
2.6.10. Checking Restore Progress Copy linkLink copied to clipboard!
Verify that a restore operation is complete.
HEAD /rest/v2/cluster/restores/{restoreName}
HEAD /rest/v2/cluster/restores/{restoreName}
A 201 (Created)
response indicates the restore operation is completed. A 202
response indicates the backup operation is in progress.
2.6.11. Deleting Restore Metadata Copy linkLink copied to clipboard!
Remove metadata for restore requests from the server. This action removes all metadata associated with restore requests but does not delete any restored content. If you delete the request metadata, you can use the request name to perform subsequent restore operations.
DELETE /rest/v2/cluster/restores/{restoreName}
DELETE /rest/v2/cluster/restores/{restoreName}
A 204
response indicates that the restore metadata is deleted. A 202
response indicates that the restore operation is in progress and will be deleted when the operation completes.
2.6.12. Checking Cluster Distribution Copy linkLink copied to clipboard!
Retrieve the distribution details about all servers in the Data Grid cluster.
GET /rest/v2/cluster?action=distribution
GET /rest/v2/cluster?action=distribution
Returns a JSON array of each Data Grid server statistics in the cluster with the format:
Each element in the array represents an Data Grid node. If the statistics collection is disabled, information about memory usage values is -1. The properties are:
-
node_name
is the node name. -
node_addresses
is a list with all the node’s physical addresses. -
memory_available
the node available memory in bytes. -
memory_used
the node used memory in bytes.
2.7. Data Grid Server logging configuration Copy linkLink copied to clipboard!
View and modify the logging configuration on Data Grid clusters at runtime.
2.7.1. Listing the logging appenders Copy linkLink copied to clipboard!
View a list of all configured appenders with GET
requests.
GET /rest/v2/logging/appenders
GET /rest/v2/logging/appenders
Data Grid responds with a list of appenders in JSON format as in the following example:
2.7.2. Listing the loggers Copy linkLink copied to clipboard!
View a list of all configured loggers with GET
requests.
GET /rest/v2/logging/loggers
GET /rest/v2/logging/loggers
Data Grid responds with a list of loggers in JSON format as in the following example:
2.7.3. Creating/modifying a logger Copy linkLink copied to clipboard!
Create a new logger or modify an existing one with PUT
requests.
PUT /rest/v2/logging/loggers/{loggerName}?level={level}&appender={appender}&appender={appender}...
PUT /rest/v2/logging/loggers/{loggerName}?level={level}&appender={appender}&appender={appender}...
Data Grid sets the level of the logger identified by {loggerName}
to {level}
. Optionally, it is possible to set one or more appenders for the logger. If no appenders are specified, those specified in the root logger will be used.
If the operation successfully completes, the service returns 204 (No Content)
.
2.7.4. Removing a logger Copy linkLink copied to clipboard!
Remove an existing logger with DELETE
requests.
DELETE /rest/v2/logging/loggers/{loggerName}
DELETE /rest/v2/logging/loggers/{loggerName}
Data Grid removes the logger identified by {loggerName}
, effectively reverting to the use of the root logger configuration.
If operation processed successfully, the service returns a response code 204 (No Content)
.
2.8. Using Server Tasks Copy linkLink copied to clipboard!
Retrieve, execute, and upload Data Grid server tasks.
2.8.1. Retrieving Server Tasks Information Copy linkLink copied to clipboard!
View information about available server tasks with GET
requests.
GET /rest/v2/tasks
GET /rest/v2/tasks
Parameter | Required or Optional | Value |
---|---|---|
| OPTIONAL |
|
Data Grid responds with a list of available tasks. The list includes the names of tasks, the engines that handle tasks, the named parameters for tasks, the execution modes of tasks, either ONE_NODE
or ALL_NODES
, and the allowed security role in JSON
format, as in the following example:
2.8.2. Executing Tasks Copy linkLink copied to clipboard!
Execute tasks with POST
requests that include the task name, an optional cache name and required parameters prefixed with param
.
POST /rest/v2/tasks/SimpleTask?action=exec&cache=mycache¶m.p1=v1¶m.p2=v2
POST /rest/v2/tasks/SimpleTask?action=exec&cache=mycache¶m.p1=v1¶m.p2=v2
Data Grid responds with the task result.
2.8.3. Uploading Script Tasks Copy linkLink copied to clipboard!
Upload script tasks with PUT
or POST
requests.
Supply the script as the content payload of the request. After Data Grid uploads the script, you can execute it with GET
requests.
POST /rest/v2/tasks/taskName
POST /rest/v2/tasks/taskName
2.8.4. Downloading Script Tasks Copy linkLink copied to clipboard!
Download script tasks with GET
requests.
GET /rest/v2/tasks/taskName?action=script
GET /rest/v2/tasks/taskName?action=script
2.9. Working with Data Grid Security Copy linkLink copied to clipboard!
View and modify security information.
2.9.1. Retrieving the ACL of a user Copy linkLink copied to clipboard!
View information about the user’s principals and access-control list.
GET /rest/v2/security/user/acl
GET /rest/v2/security/user/acl
Data Grid responds with information about the user who has performed the request. The list includes the principals of the user, and a list of resources and the permissions that user has when accessing them.
2.9.2. Flushing the security caches Copy linkLink copied to clipboard!
Flush the security caches across the cluster.
POST /rest/v2/security/cache?action=flush
POST /rest/v2/security/cache?action=flush
2.9.3. Retrieving the available roles Copy linkLink copied to clipboard!
View all the available roles defined in the server.
GET /rest/v2/security/roles
GET /rest/v2/security/roles
Data Grid responds with a list of available roles. If authorization is enabled, only a user with the ADMIN
permission can call this API.
["observer","application","admin","monitor","deployer"]
["observer","application","admin","monitor","deployer"]
2.9.4. Retrieving the available roles detailed Copy linkLink copied to clipboard!
View all the available roles defined in the server with their full detail.
GET /rest/v2/security/roles?action=detailed
GET /rest/v2/security/roles?action=detailed
Data Grid responds with a list of available roles and their detail. If authorization is enabled, only a user with the ADMIN
permission can call this API.
2.9.5. Retrieving the roles for a principal Copy linkLink copied to clipboard!
View all the roles which map to a principal.
GET /rest/v2/security/roles/some_principal
GET /rest/v2/security/roles/some_principal
Data Grid responds with a list of available roles for the specified principal. The principal need not exist in the realm in use.
["observer"]
["observer"]
2.9.6. Granting roles to a principal Copy linkLink copied to clipboard!
Grant one or more new roles to a principal.
PUT /rest/v2/security/roles/some_principal?action=grant&role=role1&role=role2
PUT /rest/v2/security/roles/some_principal?action=grant&role=role1&role=role2
Parameter | Required or Optional | Value |
---|---|---|
| REQUIRED | The name of a role |
2.9.7. Denying roles to a principal Copy linkLink copied to clipboard!
Remove one or more roles that were previously granted to a principal.
PUT /rest/v2/security/roles/some_principal?action=deny&role=role1&role=role2
PUT /rest/v2/security/roles/some_principal?action=deny&role=role1&role=role2
Parameter | Required or Optional | Value |
---|---|---|
| REQUIRED | The name of a role |
2.9.8. Listing principals Copy linkLink copied to clipboard!
List the principal names for all security realms that can enumerate users (properties
, ldap
)
GET /rest/v2/security/principals
GET /rest/v2/security/principals
Data Grid responds with a list of principals keyed to each realm
{"default:properties":["admin","user1","user2"]}
{"default:properties":["admin","user1","user2"]}
2.9.9. Creating roles Copy linkLink copied to clipboard!
Create a role by defining a name, its permissions and an optional description in the request body.
POST /rest/v2/security/permissions/somerole?permission=permission1&permission=permission2
POST /rest/v2/security/permissions/somerole?permission=permission1&permission=permission2
Parameter | Required or Optional | Value |
---|---|---|
| REQUIRED | The name of a permission |
2.9.10. Updating roles Copy linkLink copied to clipboard!
Update an existing role permissions and/or description.
POST /rest/v2/security/permissions/somerole?permission=permission1&permission=permission2
POST /rest/v2/security/permissions/somerole?permission=permission1&permission=permission2
Parameter | Required or Optional | Value |
---|---|---|
| REQUIRED | The name of a permission |
2.9.11. Deleting roles Copy linkLink copied to clipboard!
Delete an existing role.
DELETE /rest/v2/security/permissions/somerole
DELETE /rest/v2/security/permissions/somerole
2.9.12. Retrieving the permissions for a role Copy linkLink copied to clipboard!
View all the permissions of a role.
GET /rest/v2/security/permissions/somerole
GET /rest/v2/security/permissions/somerole
Data Grid responds with a list of available roles for the specified principal. The principal need not exist in the realm in use.
2.10. Enabling Tracing Propagation Copy linkLink copied to clipboard!
Tracing with Data Grid Server and REST API lets you monitor and analyze the flow of requests and track the execution path across different components.
2.10.1. Enabling tracing propagation between Data Grid Server and REST API Copy linkLink copied to clipboard!
When you enable tracing propagation between the Data Grid Server and REST API, you must configure tracing on both the client side and the server side.
To propagate the OpenTelemetry tracing spans to the Data Grid spans, you must set the trace context on each REST invocation.
Prerequisite
- Have tracing enabled on Data Grid Server and remote client side.
Procedure
Extract the current tracing context using the
io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator
.The extraction produces a context map that stores trace context information.
Pass the context map in the header of the REST call to ensure that the trace context is preserved.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The tracing spans that the client application generates are correlated with the dependent spans generated by the Data Grid Server.