[id='rest_v2_xsite_sites_status_{context}']
= Getting status of all backup locations

Retrieve the status of all backup locations with `GET` requests.

[source,options="nowrap",subs=attributes+]
----
GET /rest/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": {
    "status": "online"
  },
  "LON": {
    "status": "mixed",
    "online": [
      "NodeA"
    ],
    "offline": [
      "NodeB"
    ]
  }
}
----

.Returned Status
|===
|Value |Description

|`online`
| All nodes in the local cluster have the backup location with `online` status.

|`offline`
| All nodes in the local cluster have the backup location with `offline` status.

|`mixed`
| Some nodes in the local cluster have the backup location with `online` status while others have the backup location with `offline` status.
The response indicates status for each node.
|===

[id='rest_v2_xsite_site_status_{context}']
= Getting status of specific backup locations

Retrieve the status of a backup location with `GET` requests.

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

{brandname} responds with the status of each node 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 has `+{siteName}+` with `online` status

|`offline`
| The node has `+{siteName}+` with `offline` status

|`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_{context}']
= Taking backup locations offline

Take backup locations offline with `POST` requests and the
`?action=take-offline` parameter.

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

[id='rest_v2_xsite_bring_backup_online_{context}']
= Bringing backup locations online

Bring backup locations online with the `?action=bring-online` parameter.

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

[id='rest_v2_xsite_start_push_{context}']
= 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 /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=start-push-state
----

[id='rest_v2_xsite_cancel_state_push_{context}']
= Canceling state transfer

Cancel state transfer operations with the `?action=cancel-push-state` parameter.

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

[id='rest_v2_xsite_state_push_{context}']
= Getting state transfer status

Retrieve status of state transfer operations with the
`?action=push-state-status` parameter.

[source,options="nowrap",subs=attributes+]
----
GET /rest/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`
| The state transfer to the backup location is in progress.

|`OK`
| The state transfer completed successfully.

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

|`CANCELLING`
| The state transfer cancellation is in progress.
|===

[id='rest_v2_xsite_clear_transfer_status_{context}']
= Clearing state transfer status

Clear the state transfer status in the sending cluster with the
`?action=clear-push-state-status` parameter.
It is recommended to clear it before starting the push for a new state transfer.

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

[id='rest_v2_xsite_tuning_takeoffline_{context}']
= Modifying take offline conditions

The backup location go offline when 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 /rest/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 the take offline parameters in the body of `PUT` requests.
+
[source,options="nowrap",subs=attributes+]
----
PUT /rest/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_{context}']
= Canceling state transfer from receiving sites

If the connection between two backup locations breaks, you can cancel state transfer on the backup location that is receiving the push.

Cancel state transfer from another location and keep the current state of the local cache with the `?action=cancel-receive-state` parameter.

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

[id='rest_v2_xsite_get_state_transfer_mode_{context}']
= Retrieving the state transfer mode

Check the state transfer mode with `GET` requests.

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

[id='rest_v2_xsite_set_state_transfer_mode_{context}']
= Setting the state transfer mode

Configure the state transfer mode with the `?action=set` parameter.

[source,options="nowrap",subs=attributes+]
----
POST /rest/v2/caches/{cacheName}/x-site/backups/{site}/state-transfer-mode?action=set&mode={mode}
----