API v2 & Partner API v2
Data Ingress API v1
Getting Started
API Documentation
L3 Workbench API v1

Opportunity Querying

Certain endpoints in PrecisionLender’s APIs offer additional control over endpoint responses by way of query parameters. Detailed explanations of these parameters, along with common examples of how to use them, can be found below.

filter

The filter query parameter allows you to specify the results that you’d like returned. The syntax for a filter parameter is the following…

filter=<property name> <operator> <value>

…where <property name> refers to a key on the requested object, and <operator> refers to the comparison to be used.

Filter Operators

PrecisionLender supports the following operators in filter queries:

eq (equals), gt (greater than), lt (less than), gte (greater than or equal to), lte (less than or equal to)

Multiple Filters

Multiple filters can be specified using the , (comma) separator.

Examples of filter queries:

For the GetOpportunities endpoint, use-cases may resemble the following:

  • Get opportunities created by John.Smith@domain.com

    ?filter=creator eq John.Smith@domain.com

  • Get opportunities closed in 2019

    ?filter=closeDate gte 2019-01-01, closeDate lt 2020-01-01

  • Get opportunities in the “Eastern” region, in stage “Quoted”

    ?filter=region eq Eastern, stage eq Quoted

sort

The sort parameter allows you to order the response results by a specific property.

Ascending / Descending

The default sort is ascending. To sort by descending, prefix the property name with the - (hyphen) character.

Examples of sort queries:

For the GetOpportunities endpoint, use-cases may resemble the following:

  • Get opportunities, ordered by oldest pricing date to latest

    ?sort=pricingDate

  • Get opportunities, ordered by highest probability to lowest

    ?sort=-probability

limit

The limit query parameter is used to specify the amount of results to be returned for a single request.

If omitted, the limit property defaults to 100.

Combining Query Parameters for Useful Responses

By combining the parameters described above, it’s possible to achieve very specific results without the need for multiple requests. Some more complex use-cases may resemble the following:

  • Get John.Smith@domain.com’s opportunity with the highest probability

    ?filter=creator eq John.Smith@domain.com&sort=-probability&limit=1

  • Get the 5 opportunities with the nearest approaching close dates (assuming a date of May 1st, 2019)

    ?filter=closeDate gte 2019-05-01&sort=closeDate&limit=5