# State

### Backs up the current state of a Siddhi Application.
POST http://analytics.wso2.com/siddhi-apps/siddhi-apps/{appName}/backup

Backs up the current state of the specified Siddhi Application.

#### Request

`POST http://localhost:9090/siddhi-apps/TestSiddhiApp1/backup`

#### Response

`HTTP/1.1 201 Created Content-Type: application/json {"revision":"1499179260517_TestSiddhiApp1"}`

#### Sample CURL

`curl -k -X POST http://localhost:9090/siddhi-apps/TestSiddhiApp1/backup`

#### Parameters

Type | Name | Description | Schema | Default
--- | --- | --- | --- | ---
Path | appName required | The name of the Siddhi Application. | String |

#### Responses

HTTP Code | Description | Schema
--- | --- | ---
200 | The state of the Siddhi Application is successfully persisted. | SiddhiAppRevision
404 | The Siddhi Application specified is not found. | ApiResponseMessageWithCode
500 | An unexpected error occured. | ApiResponseMessageWithCode

### Restores the state of a Siddhi Application.
POST http://analytics.wso2.com/siddhi-apps/siddhi-apps/{appName}/restore

Restores the state of the specified Siddhi Application.

#### Request

`POST http://localhost:9090/siddhi-apps/TestSiddhiApp1/restore`

#### Response

`HTTP/1.1 200 OK Content-Type: application/json {"type":"success","message":"State restored to last revision for Siddhi App :TestSiddhiApp1"}`

#### Sample CURL

`curl -k -X POST http://localhost:9090/siddhi-apps/TestSiddhiApp1/restore`

#### Parameters

Type | Name | Description | Schema | Default
--- | --- | --- | --- | ---
Path | appName required | The name of the Siddhi Application. | String |
Query | revision optional | The revision number of the backup. | String |

#### Responses

HTTP Code | Description | Schema
--- | --- | ---
201 | The Siddhi Application is successfully restored. | ApiResponseMessage
409 | The Siddhi Application specified is not found. | ApiResponseMessageWithCode
500 | An unexpected error occured. | ApiResponseMessageWithCode