[id='rest_v2_xsite_sites_status']
= Getting Status of All Backup Locations
Retrieve the status of all backup locations with `GET` requests.

[source,options="nowrap",subs=attributes+]
----
GET /v2/caches/{cacheName}/x-site/backups/
----

{brandname} responds with the status of each backup location in JSON format, as
in the following example:

[source,json,options="nowrap",subs=attributes+]
----
{
  "NYC": "online",
  "LON": "offline"
}
----

.Returned Status

|===
|Value |Description

|`online`
| All nodes in the local cluster have a cross-site view with the backup location.

|`offline`
| No nodes in the local cluster have a cross-site view with the backup location.

|`mixed`
| 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.
|===


[id='rest_v2_xsite_site_status']
= Getting Status of Specific Backup Locations
Retrieve the status of a backup location with `GET` requests.

[source,options="nowrap",subs=attributes+]
----
GET /v2/caches/{cacheName}/x-site/backups/{siteName}
----

{brandname} responds with the status of each node in the site in JSON
format, as in the following example:

[source,json,options="nowrap",subs=attributes+]
----
{
  "NodeA":"offline",
  "NodeB":"online"
}
----

.Returned Status

|===
|Value |Description

|`online`
| The node is online.

|`offline`
| The node is offline.

|`failed`
| Not possible to retrieve status. The remote cache could be shutting down or a network error occurred during the request.
|===


[id='rest_v2_xsite_take_site_offline']
= Taking Backup Locations Offline
Take backup locations offline with `POST` requests and the
`?action=take-offline` parameter.

[source,options="nowrap",subs=attributes+]
----
POST /v2/caches/{cacheName}/x-site/backups/{siteName}?action=take-offline
----


[id='rest_v2_xsite_bring_backup_online']
= Bringing Backup Locations Online
Bring backup locations online with the `?action=bring-online` parameter.

[source,options="nowrap",subs=attributes+]
----
POST /v2/caches/{cacheName}/x-site/backups/{siteName}?action=bring-online
----


[id='rest_v2_xsite_start_push']
= Pushing State to Backup Locations
Push cache state to a backup location with the `?action=start-push-state`
parameter.

[source,options="nowrap",subs=attributes+]
----
POST /v2/caches/{cacheName}/x-site/backups/{siteName}?action=start-push-state
----


[id='rest_v2_xsite_cancel_state_push']
= Canceling State Transfer
Cancel state transfer operations with the `?action=cancel-push-state` parameter.

[source,options="nowrap",subs=attributes+]
----
POST /v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-push-state
----

[id='rest_v2_xsite_state_push']
= Getting State Transfer Status
Retrieve status of state transfer operations with the
`?action=push-state-status` parameter.

[source,options="nowrap",subs=attributes+]
----
GET /v2/caches/{cacheName}/x-site/backups?action=push-state-status
----

{brandname} responds with the status of state transfer for each backup location
in JSON format, as in the following example:

[source,json,options="nowrap",subs=attributes+]
----
{
   "NYC":"CANCELED",
   "LON":"OK"
}
----

.Returned Status

|===
|Value |Description

|`SENDING`
| State transfer to the backup location is in progress.

|`OK`
| State transfer completed successfully.

|`ERROR`
| An error occurred with state transfer. Check log files.

|`CANCELLING`
| State transfer cancellation is in progress.
|===

[id='rest_v2_xsite_clear_transfer_status']
= Clearing State Transfer Status
Clear state transfer status for sending sites with the
`?action=clear-push-state-status` parameter.

[source,options="nowrap",subs=attributes+]
----
POST /v2/caches/{cacheName}/x-site/local?action=clear-push-state-status
----

[id='rest_v2_xsite_tuning_takeoffline']
= Modifying Take Offline Conditions
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 the
`take-offline-config` parameter.
+
[source,options="nowrap",subs=attributes+]
----
GET /v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-config
----
+
The {brandname} response includes `after_failures` and `min_wait` fields as
follows:
+
[source,json,options="nowrap",subs=attributes+]
----
{
  "after_failures": 2,
  "min_wait": 1000
}
----
. Modify take offline parameters in the body of `PUT` requests.
+
[source,options="nowrap",subs=attributes+]
----
PUT /v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-config
----
If the operation successfully completes, the service returns `204 (No Content)`.

[id='rest_v2_xsite_cancel_receive_state']
= Canceling State Transfer from Receiving Sites
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.

[source,options="nowrap",subs=attributes+]
----
POST /v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-receive-state
----
