# Artifact

### Deletes the Siddhi Application.
DELETE http://analytics.wso2.com/siddhi-apps/siddhi-apps/{appName}

Removes the currently deployed Siddhi Application with the name specified. Path param of **appName** determines name of the Siddhi application.

#### Request

`DELETE http://localhost:9090/siddhi-apps/TestSiddhiApp1`

#### Response

`HTTP/1.1 200 OK`

#### Sample CURL

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

#### Parameters

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

#### Responses

HTTP Code | Description | Schema
--- | --- | ---
200 | The Siddhi Application is successfully deleted. |
400 | The Siddhi Application name provided is invalid. | ApiResponseMessageWithCode
404 | The Siddhi Application is not found. | ApiResponseMessageWithCode
500 | An unexpected error occured. | ApiResponseMessageWithCode

### Retrieves the specified Siddhi Application.
GET http://analytics.wso2.com/siddhi-apps/siddhi-apps/{appName}

Retrieves the Siddhi Application with the specified name.

#### Request

`GET http://localhost:9090/siddhi-apps/TestSiddhiApp1`

#### Response

`HTTP/1.1 200 OK {"content":" @App:name('TestSiddhiApp1') define stream FooStream (symbol string, price float, volume long); @source(type='inMemory', topic='symbol', @map(type='passThrough')) Define stream BarStream (symbol string, price float, volume long); from FooStream select symbol, price, volume insert into BarStream;"}`

#### Sample CURL

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

#### Parameters

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

#### Responses

HTTP Code | Description | Schema
--- | --- | ---
200 | The Siddhi Application is successfully retrieved. | SiddhiAppContent
404 | The Siddhi Application specified is not found. | ApiResponseMessageWithCode

### Fetches the status of the Siddhi Application.
GET http://analytics.wso2.com/siddhi-apps/siddhi-apps/{appName}/status

Fetches the status of the Siddhi Application.

#### Request

`GET http://localhost:9090/siddhi-apps/TestSiddhiApp1/status`

#### Response

`HTTP/1.1 200 OK Content-Type: application/json {"status":"active"}`

#### Sample CURL

`curl -k -X GET http://localhost:9090/siddhi-apps/TestSiddhiApp1/status`

#### 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 retrieved. | SiddhiAppStatus
404 | The Siddhi Application specified is not found. | ApiResponseMessageWithCode

### Lists Siddhi Applications.
GET http://analytics.wso2.com/siddhi-apps/siddhi-apps

Provides the name list of Siddhi Applications that exist.

#### Request

`GET http://localhost:9090/siddhi-apps`

#### Response

`HTTP/1.1 200 OK Content-Type: application/json ["TestSiddhiApp1","TestExecutionPlan6","TestSiddhiApp"]`

#### Sample CURL

`curl -k -X GET http://localhost:9090/siddhi-apps`

#### Parameters

Type | Name | Description | Schema | Default
--- | --- | --- | --- | ---
Query | isActive optional | Retrieves only active/inactive Siddhi Applications as specified. | Boolean |

#### Responses

HTTP Code | Description | Schema
--- | --- | ---
200 | The Siddhi Applications are successfully retrieved. |

### Saves the Siddhi Application.
POST http://analytics.wso2.com/siddhi-apps/siddhi-apps

Saves the Siddhi Application. Request "**siddhiApp** explains the Siddhi Query.

#### Request

`POST http://localhost:9090/siddhi-apps @App:name('TestSiddhiApp1') define stream FooStream (symbol string, price float, volume long); @source(type='inMemory', topic='symbol', @map(type='passThrough')) Define stream BarStream (symbol string, price float, volume long); from FooStream select symbol, price, volume insert into BarStream;`

#### Response

`HTTP/1.1 201 Created Location: http://localhost:9090/siddhi-apps/TestSiddhiApp1 Content-Type: application/json {"type":"success","message":"Siddhi App saved succesfully and will be deployed in next deployment cycle"}`

#### Sample CURL

`curl -k -H "Content-Type: text/plain" -X POST -d @data.json http://localhost:9090/siddhi-apps`

#### Parameters

Type | Name | Description | Schema | Default
--- | --- | --- | --- | ---
Body | body required | Siddhi Application | String (string) |

#### Responses

HTTP Code | Description | Schema
--- | --- | ---
201 | The Siddhi Application is successfully validated and saved. |
400 | A validation error occured. |
409 | A Siddhi Application with the given name already exists. |
500 | An unexpected error occured. |

### Updates the Siddhi Application.
PUT http://analytics.wso2.com/siddhi-apps/siddhi-apps

Updates the Siddhi Application. Request "**siddhiApp** explains the Siddhi Query.

#### Request

`PUT http://localhost:9090/siddhi-apps @App:name('TestSiddhiApp1') define stream FooStream (symbol string, price float, volume long); @source(type='inMemory', topic='symbol', @map(type='passThrough')) Define stream BarStream (symbol string, price float, volume long); from FooStream select symbol, price, volume insert into BarStream;`

#### Response

`HTTP/1.1 200 OK Content-Type: application/json {"type":"success","message":"Siddhi App updated succesfully and will be deployed in next deployment cycle"}`

#### Sample CURL

`curl -k -H "Content-Type: text/plain" -X PUT -d @data.json http://localhost:9090/siddhi-apps`

#### Parameters

Type | Name | Description | Schema | Default
--- | --- | --- | --- | ---
Body | body required | Siddhi Application | String (string) |

#### Responses

HTTP Code | Description | Schema
--- | --- | ---
200 | The Siddhi Application is successfully validated and updated. |
201 | The Siddhi Application is successfully validated and saved. |
400 | A validation error occured. | ApiResponseMessageWithCode
500 | An unexpected error occured. | ApiResponseMessageWithCode