Query Endpoint with data search proposal
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 Interface | Method | Scenario | HTTP response codes | Notes |
---|---|---|---|---|---|
1 | Query | Endpoint:POST /cps/v2/dataspaces/{dataspace-name}/anchor/{anchor-name}/nodes/query?cps-path=/&descendants=none | Query JSON data with flexible search options | TBD |
|
Request Parameters
Parameter Name | In | Required | Description |
---|---|---|---|
dataspace-name | path | yes | Dataspace name |
anchor-name | path | yes | Anchor Name |
cps-path | query | yes | cps path |
descendants | query | no | fetch descendants option |
operator | query | no | SQL like query operators, e.g.: equals, greater than, less than, etc |
Request Body
Type | Format | Description |
---|---|---|
text/string | JSON | JSON data to be searched |
Functional details
Use cases
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.
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