Using the EXTRACondition REST Interface

Each EXTRACondition consists of a key and value pair that specifies a resource count. To use an EXTRACondition, you must create a key and then periodically update its count as the resource count changes.

Resource counts for EXTRAConditions are created and updated with a REST API.

The EXTRACondition REST Interface root is:

http://host:port/livecluster/restadmin/extracondition-admin/

The REST interface resides on the Primary Director. Values are backed up to the Secondary Director but updates to the Secondary Director are not replicated back if the Primary Director comes back up. In the event of a Primary Director failure, you must use the Secondary Director’s URL to update the EXTRACondition values until the Primary Director comes back up.

The API includes the following resources:

extracondition — for operations on a single EXTRACondition
extraconditions — for operations on all EXTRAConditions.

REST requests use basic authentication.

Creating and Updating an EXTRACondition

HTTP PUT requests are used to create and modify an EXTRAConditon. The following syntax is used:

/restadmin/extracondition-admin/extracondition/key

The value for the key must be passed in the body of the request. The request returns the value of the EXTRACondition as a string with an HTTP Response code of 201 upon success. Any other server-side error returns exception text with an HTTP Response code of 500.

For example, the following PUT request, when made with a value in the body of the request, creates a new EXTRACondition for the key db.connections, or updates the existing db.connections EXTRACondition:

/restadmin/extracondition-admin/extracondition/db.connections

Getting an Existing EXTRACondition

An HTTP GET request can be used to retrieve the value of an EXTRACondition. The following syntax is used:

/restadmin/extracondition-admin/extracondition/key

If the EXTRACondition is not found, an HTTP Response code of 404 is returned. Any other server-side error returns exception text with an HTTP Response code of 500.

For example, the following GET request returns the value of the EXTRACondition of the key db.connections as a string with an HTTP Response code of 200 upon success:

/restadmin/extracondition-admin/extracondition/db.connections

Deleting an existing EXTRACondition

An HTTP DELETE request can be used to remove an EXTRACondition. The following syntax is used:

/restadmin/extracondition-admin/extracondition/key

The request returns with an HTTP Response code of 200 even if the key does not exist. It only returns an exception text with an HTTP Response code of 500 for other server errors or an existing EXTRACondition was not able to be deleted.

For example, the following DELETE request deletes the EXTRACondition with the key db.connections.

/restadmin/extracondition-admin/extracondition/db.connections

Batch Operations

There is also an extraconditions resource that enables you to make an HTTP GET to retrieve all EXTRAConditions. The following syntax is used

/restadmin/extracondition-admin/extraconditions

The request returns a JSON array of key-value pairs formatted like the following:

{
    "Boston.BigFatDB.Connections":600,
    "SF.BigFatDB.Connections":500,
    "NYC.BigFatDB.Connections":1000
}

Similarly, an HTTP PUT with the same JSON in the body of the request updates or creates all pairs in the list.

To batch delete EXTRAConditions, you must use an HTTP PUT using the following syntax:

/restadmin/extracondition-admin/extraconditions/delete

The keys being deleted must be passed in the body of the request, like the following:

{
    "Boston.BigFatDB.Connections",
    "SF.BigFatDB.Connections",
    "NYC.BigFatDB.Connections"
}

Batch operation requests return with an HTTP Response code of 200 upon success. Any other server-side error returns exception text with an HTTP Response code of 500.