Welcome to the Infinispan RESTful Server

This server provides easy to use RESTful access to the Infinispan data grid. See below for usage details.

Configuration

Out of the box, Infinispan will use its LOCAL mode cache. To set a custom configuration, create an infinispan config file (xml) and set it as either the System property called "infinispan.server.rest.cfg" (without quotes, obviously) or a web context attribute of the same name. The value should be a path to your config file (eg on the command line: -Dinfinispan.server.rest.cfg=/somewhere/infinispan.xml)

Putting data in
HTTP PUT and POST methods are used to place data in the cache - the data being the body of the request (the data can be anything you like). It is important that a Content-Type header is set.
PUT /{cacheName}/{cacheKey}
A PUT request of the above URL form will place the payload (body) in the given cache, with the given key (if the cache name is new, it will be automatically initialised). For example http://someserver/hr/payRoll/3 (in which case "hr" is the cache name, and "payRoll/3" is the key). Any existing data will be replaced, and Time-To-Live and Last-Modified values etc will updated (if applicable).
POST /{cacheName}/{cacheKey}
Exactly the same as PUT, only if a value in a cache/key already exists, it will return a Http CONFLICT status (and the content will not be updated).
Headers:
  • Content-Type: MANDATORY (use media/mime-typesfor example "application/json").
  • timeToLiveSeconds: OPTIONAL number (the number of seconds before this entry will automatically be deleted)
  • maxIdleTimeSeconds: OPTIONAL number (the number of seconds after last usage of this entry when it will automatically be deleted)
  • performAsync: OPTIONAL true/false (if true, this will return immediately, and then replicate data to the cluster on its own. Can help with bulk data inserts/large clusters.)
  • Getting data back out
    HTTP GET and HEAD are used to retrieve data from entries.
    GET /{cacheName}/{cacheKey}
    This will return the data found in the given cacheName, under the given key - as the body of the response. A Content-Type header will be supplied which matches what the data was inserted as. Browsers can use the cache directly of course (eg as a CDN).

    An ETag will be returned unique for each entry, as will the Last-Modified header field indicating the state of the data at the given URL. ETags allow browsers (and other clients) to ask for data only in the case where it has changed (to save on bandwidth) - this is standard HTTP and is honoured by Infinispan.

    HEAD /{cacheName}/{cacheKey}
    The same as GET, only no content is returned (only the header fields).
    Removing data
    Data can be removed at the cache key/element level, or via a whole cache name using the HTTP delete method.
    DELETE /{cacheName}/{cacheKey}
    Removes the given key name from the cache.

    DELETE /{cacheName}
    Removes ALL the entries in the given cache name (ie everything from that path down).

    OPTIONAL: Set the header performAsync to true to return immediately and let the removal happen in the background.

    See, easy !

    This was built with RESTEasy so it should be easy !
    Clients
    Any http client will do - from any language. See here for more details.
    Deployment
    As Infinispan is a distributed cache, it shouldn't matter how many or which instance of the Server you access, as long as it is part of the Infinispan cluster, it will find your data, and manage it. You can have as many instances (including the one you are looking at) as you need.