Stream Processor REST API Guide
The following table shows the APIs exposed from WSO2 Stream Processor.
Method | API Context | Example | Description | Runtime | API Docs | |
---|---|---|---|---|---|---|
Stream Processor API | POST | /siddhi-apps | curl -X POST "https://localhost:9443/siddhi-apps" -H "accept: application/json" -H "Content-Type: text/plain" -d @TestSiddhiApp.siddhi -u admin:admin -k | Send Siddhi App as the Body | Worker/Manager | https://docs.wso2.com/display/DAS400/apidocs/siddhiapps/ |
PUT | /siddhi-apps | curl -X PUT "https://localhost:9443/siddhi-apps" -H "accept: application/json" -H "Content-Type: text/plain" -d @TestSiddhiApp.siddhi -u admin:admin -k | Update the siddhi App | |||
DELETE | /siddhi-apps/{appName} | curl -X DELETE "https://localhost:9443/siddhi-apps/TestSiddhiApp" -H "accept: application/json" -u admin:admin -k | Pass Siddhi App name as url param | |||
GET | /siddhi-apps | curl -X GET "https://localhost:9443/siddhi-apps?isActive=true" -H "accept: application/json" -u admin:admin -k | Lists all active Siddhi Apps with query If isActive=true, then list the active Siddhi Apps, else list the inactive Siddhi Apps. | |||
GET | /siddhi-apps/{appName} | curl -X GET "https://localhost:9443/siddhi-apps/SiddhiTestApp" -H "accept: application/json" -u admin:admin -k | Fetch a speciffic Siddhi App | |||
GET | /siddhi-apps/{appName}/status | curl -X GET "https://localhost:9443/siddhi-apps/TestSiddhiApp/status" -H "accept: application/json" -u admin:admin -k | Fetches the status of the Siddhi Application. | |||
POST | /siddhi-apps/{appName}/backup | curl -X POST "https://localhost:9443/siddhi-apps/TestSiddhiApp/backup" -H "accept: application/json" -u admin:admin -k | Take a snapshot of the provided Siddhi App | |||
POST | /siddhi-apps/{appName}/restore /siddhi-apps/{appName}/restore?version= | curl -X POST "https://localhost:9443/siddhi-apps/TestSiddhiApp/restore?revision=1514981290838_TestSiddhiApp" -H "accept: application/json" -u admin:admin -k | Restore the Siddhi App with the created snapshot | |||
GET | /statistics | curl -X GET "https://localhost:9443/statistics" -H "accept: application/json" -u admin:admin -k | Returnsreal timestatistics of a worker | |||
PUT | /statistics | curl -X PUT "https://localhost:9443/statistics" -H "accept: application/json" -H "Content-Type: application/json" -d "{“statsEnable”:”true”}" -u admin:admin -k | Enable/disable worker statistics | |||
GET | /system-details | curl -X GET "https://localhost:9443/system-details" -H "accept: application/json" -u admin:admin -k | Returns general details of worker | |||
GET | /siddhi-apps/statistics | curl -X GET "https://localhost:9443/siddhi-apps/statistics" -H "accept: application/json" -u admin:admin -k | Returns statistics details of All Siddhi Apps | |||
PUT | /siddhi-apps/{appName}/statistics | curl -X PUT "https://localhost:9443/siddhi-apps/TestSiddhiApp/statistics" -H "accept: application/json" -H "Content-Type: application/json" -d "{“statsEnable”:”true”}" -u admin:admin -k | Enable/disable statistics of a given Siddhi App | |||
PUT | /siddhi-apps/statistics | curl -X PUT "https://localhost:9443/siddhi-apps/statistics" -H "accept: application/json" -H "Content-Type: application/json" -d "{“statsEnable”:”true”}" -u admin:admin -k | Enable/disable statistics of all Siddhi Apps | |||
Event Simulator API | POST | /simulation/single | curl -X POST "http://localhost:9390/simulation/single" -H "accept: application/json" -H "content-type: text/plain" -d "{ \"streamName\": \"FooStream\", \"siddhiAppName\": \"TestSiddhiApp\", \"timestamp\": \"1500319950004\", \"data\": [ \"foo\", \"bar\", \"12345\" ]}" | Send single event for simulation | Worker (https port: 9443, http port:9090) (for worker environment need to be add authorization header -u admin:admin ) Editor (port:9390) | https://docs.wso2.com/ display/SP400/Simulating+Events |
POST | /simulation/feed | curl -X POST "http://localhost:9390/simulation/feed" -H "accept: application/json" -H "content-type: text/plain" -d "{\"properties\":{\"simulationName\":\"TestFeedSimulation\",\"startTimestamp\":\"1500319950003\",\"endTimestamp\":\"1500319950009\",\"noOfEvents\":\"100\",\"description\":\"Test feed simulator\",\"timeInterval\":\"1000\"},\"sources\":[{\"siddhiAppName\":\"TestSiddhiApp\",\"streamName\":\"FooStream\",\"timestampInterval\":\"1000\",\"simulationType\":\"CSV_SIMULATION\",\"fileName\":\"foostream.csv\",\"delimiter\":\",\",\"isOrdered\":true,\"indices\":\"0,1,2\"}]}" | Upload feed simulation config | |||
GET | /simulation/feed | curl -X GET "http://localhost:9390/simulation/feed" -H "accept: application/json" | Retrieve all feed simulation configurations | |||
PUT | /simulation/feed/{simulationName} | curl -X PUT "http://localhost:9390/simulation/feed/TestFeedSimulation" -H "accept: application/json" -H "content-type: text/plain" -d "{\"properties\":{\"simulationName\":\"TestFeedSimulation\",\"startTimestamp\":\"\",\"endTimestamp\":\"\",\"noOfEvents\":\"100\",\"description\":\"Test feed simulator\",\"timeInterval\":\"1000\"},\"sources\":[{\"siddhiAppName\":\"TestSiddhiApp\",\"streamName\":\"BarStream\",\"timestampInterval\":\"1000\",\"simulationType\":\"CSV_SIMULATION\",\"fileName\":\"foostream.csv\",\"delimiter\":\",\",\"isOrdered\":true,\"indices\":\"0,1,2\"}]}" | Update a feed simulation config | |||
GET | /simulation/feed/{simulationName} | curl -X GET "http://localhost:9390/simulation/feed/TestFeedSimulation" -H "accept: application/json" | Retreieve a feed simulation config | |||
DELET | /simulation/feed/{simulationName} | curl -X DELETE "http://localhost:9390/simulation/feed/TestFeedSimulation" -H "accept: application/json" | Delete a feed simulation config | |||
POST | /simulation/feed/{simulationName}?action=run | curl -X POST "http://localhost:9390/simulation/feed/TestFeedSimulation/?action=run" -H "accept: application/json" | Run a feed simulation | |||
POST | /simulation/feed/{simulationName}?action=pause | curl -X POST "http://localhost:9390/simulation/feed/TestFeedSimulation/?action=pause" -H "accept: application/json" | Pause a feed simulation | |||
POST | /simulation/feed/{simulationName}?action=resume | curl -X POST "http://localhost:9390/simulation/feed/TestFeedSimulation/?action=resume" -H "accept: application/json" | Resume a feed simulation | |||
POST | /simulation/feed/{simulationName}?action=stop | curl -X POST "http://localhost:9390/simulation/feed/TestFeedSimulation/?action=stop" -H "accept: application/json" | Stop a feed simulation | |||
POST | /simulation/feed/{simulationName}?action=resume | curl -X POST "http://localhost:9390/simulation/feed/TestFeedSimulation/?action=resume" -H "accept: application/json" | Resume a feed simulation | |||
GET | /simulation/feed/{simulationName}/status | curl -X GET "http://localhost:9390/simulation/feed/TestFeedSimulation/status" -H "accept: application/json" | Retrieve a simulation configuration status by name. | |||
POST | /simulation/files | curl -X POST -F 'file=@foostream.csv' http://localhost:9390/simulation/files | Upload a csv file | |||
GET | /simulation/files | curl -X GET "http://localhost:9390/simulation/files" -H "accept: application/json" | Get CSV file names | |||
PUT | /simulation/files/{fileName} | curl -X PUT -F 'file=@foostream.csv' http://localhost:9390/simulation/files/foostream.csv?fileName=foostream.csv | Update a csv file | |||
DELET | /simulation/files/{fileName} | curl -X DELETE "http://localhost:9390/simulation/files/CSVTestFile.csv" -H "accept: application/json" | Delete a csv file | |||
POST | /simulation/connectToDatabase | Test a database connection. | ||||
POST | /simulation/connectToDatabase/retrieveTableNames | Retreive database tables | ||||
POST | /simulation/connectToDatabase/{tableName}/retrieveColumnNames | Retreive database table columns | ||||
Status Dashboard APIs | GET | /monitoring/apis/workers | curl -X GET "https://localhost:9643/monitoring/apis/workers" -H "accept: application/json" -u admin:admin -k | List all registered workers | Dashboard | |
POST | /monitoring/apis/workers | curl -X POST "https://localhost:9643/monitoring/apis/workers" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"host\": \"localhost\", \"port\": \"9443\"}" -u admin:admin -k | Add a worker | |||
DELETE | /monitoring/apis/workers/{workerId} | curl -X DELETE "https://localhost:9643/monitoring/apis/workers/localhost_9095" -H "accept: application/json" -u admin:admin -k | Delete a worker | |||
POST | /monitoring/apis/workers/{workerId}/system-details | curl -X POST "https://localhost:9643/monitoring/apis/workers/localhost_9444/system-details" -H "accept: application/json" -u admin:admin -k | Get general details of a worker | |||
POST | /monitoring/apis/workers/{workerId}/status | curl -X POST "https://localhost:9643/monitoring/apis/workers/localhost_9444/status" -H "accept: application/json" -u admin:admin -k | Test the connection of a worker | |||
GET | /monitoring/apis/workers/{workerId}/history?period=’2 hr’,type=cpu,memory,latency | curl -X GET "https://localhost:9643/monitoring/apis/workers/localhost_9444/history?period=5min" -H "accept: application/json" -u admin:admin -k | Get history statistics details of a worker | |||
GET | /monitoring/apis/workers/{workerId}/siddhi-apps | curl -X GET "https://localhost:9643/monitoring/apis/workers/localhost_9444/siddhi-apps" -H "accept: application/json" -u admin:admin -k | Get details of all Siddhi Apps of a given worker | |||
GET | /monitoring/apis/workers/{workerId}/siddhi-apps/{appName} | curl -X GET "https://localhost:9643/monitoring/apis/workers/localhost_9095/siddhi-apps/TestSiddhiApp" -H "accept: application/json" -u admin:admin -k | Get text view and flow of a siddhi-app | |||
GET | /monitoring/apis/workers/{workerId}/siddhi-apps | curl -X GET "https://localhost:9643/monitoring/apis/workers/localhost_9444/siddhi-apps" -H "accept: application/json" -u admin:admin -k | Get details of all Siddhi Apps of a given worker | |||
PUT | /monitoring/apis/workers/{workerId}/siddhi-apps/{appName}/statistics | curl -X PUT "https://localhost:9643/monitoring/apis/workers/localhost_9444/siddhi-apps/TestSiddhiApp/statistics" -H "accept: application/json" -H "Content-Type:application/json" -d "{statsEnable: false}" -u admin:admin -k -v | Enable/disable Siddhi App statistics | |||
GET | /monitoring/apis/workers/{workerId}/siddhi-apps/{appName}/history?period=’2hr’,type=cpu,memory | curl -X GET "https://localhost:9643/monitoring/apis/workers/localhost_9444/siddhi-apps/TestSiddhiApp/history?period=5min" -H "accept: application/json" -u admin:admin -k | Get history statistics details of a siddhi app | |||
GET | /monitoring/apis/workers/{workerId}/siddhi-apps/{appName}/components | curl -X GET "https://localhost:9643/monitoring/apis/workers/localhost_9444/siddhi-apps/TestSiddhiApp/components" -H "accept: application/json" -u admin:admin -k -v | Get the component list and the component current metrics. | |||
GET | /monitoring/apis/workers/{workerId}/siddhi-apps/{appName}/components/{componentType}/{componentId}/history?period=’2hr’,type=cpu,... | curl -X GET "https://localhost:9643/monitoring/apis/workers/localhost_9444/siddhi-apps/TestSiddhiApp/components/Streams/FooStream/history?period=5min" -H "accept: application/json" -u admin:admin -k | Get history statistics details of a siddhi app component | |||
GET | /monitoring/apis/workers/roles?permissionSuffix=manager | curl -X GET "https://localhost:9643/monitoring/apis/workers/roles?permissionSuffix=metrics.manager" -H "accept: application/json" -u admin:admin -k | Get user roles of a specified user | |||
GET | /monitoring/apis/workers/config | curl -X GET "https://localhost:9643/monitoring/apis/workers/config" -H "accept: application/json" -u admin:admin -k | Reading the dashboard configuration details from thedeplomentYML of dashboard running server | |||
GET | /monitoring/apis/workers/{workerId}/ha-status | curl -X GET "https://localhost:9643/monitoring/apis/workers/localhost_9444/ha-status" -H "accept: application/json" -u admin:admin -k -v | Get all HA Status | |||
Dashboard | GET | /portal/apis/dashboards | curl -X GET "https://localhost:9643/portal/apis/dashboards" -H "accept: application/json" -u admin:admin -k | List dashboards | Dashboard | |
GET | /portal/apis/dashboards/{dashboard-id} | curl -X GET "https://localhost:9643/portal/apis/dashboards/salesdashboard" -H "accept: application/json" -u admin:admin -k | Get dashboard by ID | |||
POST | /portal/apis/dashboards | curl -X POST "https://localhost:9643/portal/apis/dashboards" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"url\":\"sampledashboard\",\"name\":\"Sample Dashboard\",\"description\":\"This is a sample dashboard\",\"landingPage\":\"overview\",\"parentId\":\"1\",\"owner\":\"test\",\"pages\":[]}" -u admin:admin -k | Create dashboard | |||
PUT | /portal/apis/dashboards/{dashboard-id} | curl -X PUT "https://localhost:9643/portal/apis/dashboards/sampledashboard" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"url\":\"sampledashboard\",\"name\":\"Sample Dashboard\",\"description\":\"This is a sample dashboard 2\",\"landingPage\":\"overview\",\"parentId\":\"1\",\"owner\":\"test\",\"pages\":[]}" -u admin:admin -k | Update a dashboard | |||
DELETE | /portal/apis/dashboards/{dashboard-id} | curl -X DELETE "https://localhost:9643/portal/apis/dashboards/sampledashboard" -H "accept: application/json" -u admin:admin -k | Delete a dashboard | |||
GET | /portal/apis/widgets/ | curl -X GET "https://localhost:9643/portal/apis/widgets" -H "accept: application/json" -u admin:admin -k | List metadata of widgets | |||
Authentication API | POST | /login/{appName} | curl -X POST "https://localhost:9643/login/portal" | Login to a dashboard app | Dashboard | |
GET | /login/callback/{appName} | curl -X GET "https://localhost:9643/login/callback/portal" | Redirect URL by the IS in authorization grant type - OAuth2 | |||
POST | /logout/{appName} | curl -X POST "https://analytics.wso2.com/logout/portal" -H "accept: application/json" -H "Authorization: Bearer 12345678" | Lgout of the dashboard app | |||
Permission API | POST | /permissions | curl -X POST https://localhost:9443/permissions/ -H 'content-type: application/json' -d ' { "appName":"MON", "permissionString":"MON.manager"}' -k | Add new permission string (Pass appname and permission-string as json body). Return PERMISSION_ID | Dashboard/Worker | |
GET | /permissions/app/{appName} | curl -X GET https://localhost:9443/permissions/app/MON | Get permissionID for PermissionString | |||
GET | permissions/auth/{permissionID}/{roleName} | curl -X GET https://localhost:9443/permissions/auth/8dc31fec-8364-3082-9f88-c7ca7d979873/admin | Check whether specific role has some permission or not | |||
DELETE | /permissions/{permissionID} | curl -X DELETE https://localhost:9443/permissions/e9687c6f-b5b2-3216-b3bd-82e7a8e14367 | Delete a permission string | |||
GET | /permissions/{permissionsID}/roles | curl -X GET https://localhost:9443/permissions/8dc31fec-8364-3082-9f88-c7ca7d979873/roles | List down roles which has the specific permission defined as a path param | |||
POST | /permissions/revoke/{permissionID} | curl -X POST https://localhost:9443/permissions/revoke/8dc31fec-8364-3082-9f88-c7ca7d979873 | Revoke the specific permission defined in path param for all the roles | |||
POST(Permission) | /permissions/roles/{roleID}?action=revoke/grant | curl -X POST 'https://localhost:9443/permissions/roles/admin?action=revoke' -H 'content-type: application/json' -d ' { "appName":"MON", "permissionString":"MON.manager"}' | To grant or revoke permissions for a role. Pass the permissions as an array in the body | |||
Business Rules | DELETE | /business-rules/instances/{businessRuleInstanceID}?force-delete=false | curl -X DELETE "https://localhost:9643/business-rules/instances/business-rule-1?force-delete=false" -H "accept: application/json" -u admin:admin -k | Deletes the business rule that has the given UUID | Dashboard | |
GET | /business-rules/instances | curl -X GET "https://localhost:9643/business-rules/instances" -u admin:admin -k | Gets available list of business rule instances | |||
GET | /business-rules/template-groups/{templateGroupID} | curl -X GET "https://localhost:9643/business-rules/template-groups/sweet-factory" -u admin:admin -k | Gets template group that has the given UUID | |||
GET | /business-rules/template-groups/{templateGroupID}/templates | curl -X GET "https://localhost:9643/business-rules/template-groups/sweet-factory/templates" -u admin:admin -k | Gets rule templates available under the template group with the given UUID | |||
GET | /business-rules/template-groups/{templateGroupID}/templates/{ruleTemplateID} | curl -X GET "https://localhost:9643/business-rules/template-groups/sweet-factory/templates/identifying-continuous-production-decrease" -u admin:admin -k | Gets the rule template that has the given UUID, which is available under the template group with the given UUID | |||
GET | /business-rules/template-groups | curl -X GET "https://localhost:9643/business-rules/template-groups" -u admin:admin -k | Gets available template groups | |||
GET | /business-rules/instances/{businessRuleInstanceID} | curl -X GET "https://localhost:9643/business-rules/instances/business-rule-1" -H "accept: application/json" -u admin:admin -k | Gets a business rule instance that has the given UUID | |||
POST | /business-rules/instances?deploy={deploymentStatus} | curl -X POST "https://localhost:9643/business-rules/instances?deploy=true" -H "accept: application/json" -H "content-type: multipart/form-data" -F 'businessRule={"name":"Business Rule 5","uuid":"business-rule-5","type":"template","templateGroupUUID":"sweet-factory","ruleTemplateUUID":"identifying-continuous-production-decrease","properties":{"timeInterval":"6","timeRangeInput":"5","email":"example@email.com"}}' -u admin:admin -k | Creates and saves a business rule from template / from scratch instance, from the given form data, and deploys/not as specified in the query parameter | |||
PUT | /business-rules/instances/{businessRuleInstanceID}?deploy={deploymentStatus} | curl -X PUT "https://localhost:9643/business-rules/instances/business-rule-5?deploy=true" -H "accept: application/json" -H "content-type: application/json" -d '{"name":"Business Rule 5","uuid":"business-rule-5","type":"template","templateGroupUUID":"sweet-factory","ruleTemplateUUID":"identifying-continuous-production-decrease","properties":{"timeInterval":"9","timeRangeInput":"8","email":"newexample@email.com"}}' -u admin:admin -k | Updates a business rule instance that has the given UUID, and re-deploys/not as specified in the query parameter | |||
Store API | POST | /stores/query | curl -X POST https://localhost:9443/stores/query -H "content-type: application/json" -u "admin:admin" -d '{"appName" : "AggregationTest", "query" : "from stockAggregation select *" }' -k | To retrieve the records in a siddhi store. For appName, the user needs to give the siddhiApp which has the siddhi store which user wants to query data from. For the query, user needs to provide the query saying from which table he/she wants to query and the condition to filter the data | Worker |