Issues and Decisions

Objective

The objective of this proposal is a new CPS query endpoint, which can be used to perform data search operations on a JSON data with SQL-like query operations, providing more flexible options to fetch data.

The proposed API is a POST operation which can be used to send the data to be searched in form of a JSON payload, along with search parameters like the operators to be used for search. Based on the provided input parameters a resultant JSON data will be fetched and returned to the user.

Proposed API

#Sub InterfaceMethodScenarioHTTP response codesNotes
1

Query

Endpoint:

POST /cps/v2/dataspaces/{dataspace-name}/anchor/{anchor-name}/nodes/query?cps-path=/&descendants=none

Query JSON data with flexible search optionsTBD

Request Parameters

Parameter NameInRequiredDescription
dataspace-namepathyesDataspace name
anchor-namepathyesAnchor Name
cps-pathqueryyescps path
descendantsquerynofetch descendants option
operatorquerynoSQL like query operators, e.g.: equals, greater than, less than, etc

Request Body

TypeFormatDescription
text/stringJSONJSON data to be searched 

Functional details

Use cases

  1. We want to query data nodes and get only selected few leaves. It will help to limit the output data and also in searching if a leaf in present in a data node or not. 
  2. Search of a specific leaf without knowing actual cps-path. If a client is not sure about the cps-path but he wants to query for a given leaf nod
  • No labels