You are here: Integrating With CPQ Cloud > REST APIs > Query Specification Syntax

Query Specification Syntax

OVERVIEW

When query REST calls need to be more specific, CPQ Cloud can interpret query specifications that follow CPQ Cloud query and pagination parameters syntax (specified below), and query specifications that follow a subset of MongoDB syntax.

Not all MongoDB syntax can be interpreted by CPQ Cloud. See the MongoDB Query Specifications section for more information.

ADMINISTRATION

ClosedQuery and Pagination Parameters Rules


ClosedQuery and Pagination Parameters URL Format

{resourceURI}?{param}={paramSpec}&{param}={paramSpec}&{param}={paramSpec}

URL Parameter Description

{resourceURI}

The URI endpoint of the REST API resource.

{param}

A query parameter (see the Query Parameters and Pagination Parameters lists below for parameter names, descriptions, and examples).

{paramSpec}

The parameter specification of the preceding parameter.


ClosedQuery Parameters


ClosedPagination Parameters


ClosedMongoDB Query Specifications

When a q parameter is introduced within query parameters, CPQ Cloud will interpret the subsequent query specification as a JSON construct following MongoDB query syntax. The MongoDB expression can contain a single condition, or multiple conditions that are combined with a conjunction operator.

$and and $or are the only MongoDB conjunction operators that can be interpreted by CPQ Cloud.

Each condition must be expressed as a name-value pair, using the following format:

{[varName]:{$[op]’[value]’}}

Condition Parameter Description

[varName]

The variable name of the attribute being used in the condition.

[op]

The comparison operator to relate the attribute with an attribute value.

[value]

The value of the attribute to relate to the comparison operator

The following MongoDB comparison operators are the only comparison operators that can be interpreted by CPQ Cloud.

Comparison Operator Description Example

eq

Equals (=)

q={createdBy:{$eq: 'Matt'}}

ne

Not equals (<>)

q={createdBy:{$ne: 'Matt'}}

gt

Greater than (>)

q={quantity:{$gt: '100'}}

gte

Greater than or equals (>=)

q={quantity:{$gte: '100'}}

lt

Less than (<)

q={quantity:{$lt: '100'}}

lte

Less than or equals (<=)

q={quantity:{$lte: '100'}}

exists

  • exists true = IS NOT NULL
  • exists false = IS NULL

q={createdBy:{$exists:true}}

For more information on MongoDB syntax, see MongoDB’s Query Documents documentation.


NOTES

RELATED TOPICS

Related Topics Link IconSee Also