The latest version for DAS is WSO2 Data Analytics Server 3.1.0. View documentation for the latest release.
WSO2 Data Analytics Server is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.

All docs This doc
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
||
Skip to end of metadata
Go to start of metadata

Overview

DescriptionSearching records of a table
Resource Path

POST

HTTP Method/analytics/search
Request/Response Formatapplication/json
AuthenticationBasic

Prerequisites

The records in the event table need to be indexed in order to be retrieved. e.g., The state attribute (in the sample cUrRL command below) should be indexed before publishing data to the event stream in which it is included. For more information on indexing, see Configuring Indexes. Additionally it supports sorting by an indexed field. Records can be sorted by multiple fields. If two records has the same value, then it will sort those two records by the second field in the given array in "sortBy" attribute.

Sample cURL command

curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46YWRtaW4=" -v https://localhost:9443/analytics/search -d '{"tableName":"ORG_WSO2_DAS_SAMPLE_SMART_HOME_DATA", "query":"state:Texas", "start":0, "count":3, "columns": ["price", "size", "version", "name"], "sortBy" : [{"field" : "device_id", "sortType" : "ASC"}]}' -k

Example

POST https://localhost:9443/analytics/search 
{
 "tableName":"books",
 "query":"name:MyBook",
 "start":0,
 "count":100,
 "columns": ["price", "size", "version", "name"],
 "sortBy" : [{
    "field" : "PRICE",
    "sortType" : "ASC"
  },
  {
    "field" : "SIZE",
    "sortType" : "ASC"
  }
 ]
 }

Sample output

[  
   {  
      "id":"14242656601230.5739142271249453",
      "tableName":"Books",
      "timestamp":1424265660123,
      "values":{  
         "PRICE": 100,
         "SIZE" : 200,
         "version" : 1,
		 "name":"MyBook"
      }
   },
   {  
      "id":"14242656601230.5739142271249454",
      "tableName":"Books",
      "timestamp":1424265660124,
      "values":{  
         "PRICE": 120,
         "SIZE" : 120,
         "version" : 2,
		 "name":"MyBook"
      }
   }
 ]

REST API response


HTTP status code

200

For descriptions of the HTTP status codes, see HTTP Status Codes.

  • No labels