You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Objective : we want to include limit/depth/pagination in CPS-Core query APIs where output size is large. it will allow user to limit query outputs.


Implementation


URL ChangesComments
URL: http://<IP:PORT>/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/node?xpath=/&include-decendents=true&depth=1depth is an optional query parameter 
URL: http://<IP:PORT>/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query?cps-path=/&include-decendents=true&depth=1depth is an optional query parameter 


Code changes: 



cpsData.yml
nodeByDataspaceAndAnchor:
get:
description: Get a node with an option to retrieve all the children for a given anchor and dataspace
tags:
- cps-data
summary: Get a node
operationId: getNodeByDataspaceAndAnchor
parameters:
- $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
- $ref: 'components.yml#/components/parameters/anchorNameInPath'
- $ref: 'components.yml#/components/parameters/xpathInQuery'
- $ref: 'components.yml#/components/parameters/includeDescendantsOptionInQuery'
      - $ref: 'components.yml#/components/parameters/depthInQuery'
...
cpsQuery.yml
nodesByDataspaceAndAnchorAndCpsPath:
get:
description: Query data nodes for the given dataspace and anchor using CPS path
tags:
- cps-query
summary: Query data nodes
operationId: getNodesByDataspaceAndAnchorAndCpsPath
parameters:
- $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
- $ref: 'components.yml#/components/parameters/anchorNameInPath'
- $ref: 'components.yml#/components/parameters/cpsPathInQuery'
- $ref: 'components.yml#/components/parameters/includeDescendantsOptionInQuery'
- $ref: 'components.yml#/components/parameters/depthInQuery'
...
components.yml
depthInQuery:
name: depth
in: query
description: depth parameter for large query outputs
required: false
schema:
type: string
default: all
examples:
container depth:
value: 1
  • No labels