Search with Advance Query Descriptor

For a better understanding of the design and uptake of advanced query engine, review the Query Expression topic.

Equals

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields":["PartyUniqueName", "PrimaryAddress"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":{"op": "$eq" , "attribute": "PartyUniqueName", "value": "A-Mark Precious Metals (Santa Monica, US)"}
}

Not equals

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields":["PartyUniqueName", "PrimaryAddress"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":{"op": "$ne" , "attribute": "PartyUniqueName", "value": "A-Mark Precious Metals (Santa Monica, US)"}
}

Exists

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields":["PartyUniqueName", "PrimaryAddress"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":{"op": "$pr" , "attribute": "PrimaryIndustry"}
}

Not exists

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields":["PartyUniqueName", "PrimaryAddress"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":{"op": "$npr" , "attribute": "PrimaryIndustry"}
}

All

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields":["PartyUniqueName", "PrimaryAddress"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":{"op": "$all" , "attribute": "PartyUniqueName", "value": "Technologies United"}
}

Any

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields":["PartyUniqueName", "PrimaryAddress"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":{"op": "$any" , "attribute": "PartyUniqueName", "value": "Technologies United"}
}

None

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields":["PartyUniqueName", "PrimaryAddress"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":{"op": "$none" , "attribute": "PartyUniqueName", "value": "Technologies United"}
}

In

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields":["PartyUniqueName", "PrimaryAddress"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":{"op": "$in" , "attribute": "PartyUniqueName", "value": "Technologies United"}
}

Not in

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields":["PartyUniqueName", "PrimaryAddress"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":{"op": "$notin" , "attribute": "PartyUniqueName", "value": "Technologies United"}
}

Between

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields": ["PartyUniqueName","PrimaryAddress","CreationDate"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q" : {"op": "$wi", "attribute": "CreationDate", "value1": "now-1y/y", "value2": "now"}
}

Greater than

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields": ["PartyUniqueName","PrimaryAddress","CreationDate"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q" : {"op": "$gt", "attribute": "CreationDate", "value": "now-1y/y"}
}

Greater than equals

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields": ["PartyUniqueName","PrimaryAddress","CreationDate"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q" : {"op": "$ge", "attribute": "CreationDate", "value": "now-1y/y"}
}

Less than

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields": ["PartyUniqueName","PrimaryAddress","CreationDate"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q" : {"op": "$lt", "attribute": "CreationDate", "value": "now-1y/y"}
}

Leass than equals

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields": ["PartyUniqueName","PrimaryAddress","CreationDate"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q" : {"op": "$le", "attribute": "CreationDate", "value": "now-1y/y"}
}

Fuzzy match

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields":["PartyUniqueName", "PrimaryAddress"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":{"op": "$fm" , "attribute": "PartyUniqueName", "value": "United"}
}

And Operator Search with query descriptor

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields": ["PartyUniqueName","PrimaryAddress","CreationDate"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q": {"op": "$and",
        "criteria": [
                {"op": "$eq",
                "attribute": "PrimaryAddress.State",
                "value": "CA"},
                {"op": "$co" ,
                "attribute": "PartyUniqueName",
                "value": "Oracle"}]}
}

Or Operator Search with query descriptor

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity":"Account",
    "fields": ["PartyUniqueName","PrimaryAddress","CreationDate"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q": {"op": "$or",
        "criteria": [
                {"op": "$sw",
                "attribute": "PartyUniqueName",
                "value": "United"},
                {"op": "$co" ,
                "attribute": "PartyUniqueName",
                "value": "Oracle"}]}
}

Not Operator Search with query descriptor

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{   "entity":"Account",
    "fields": ["PartyUniqueName","PrimaryAddress","CreationDate"],
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q": {"op": "$not",
            "criterion": {"op": "$sw",
            "attribute": "PartyUniqueName", "value": "United"}}
}

Querying Nested Record/Foreign Key attributes

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{    "entity" : "Account",
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":
        {"op": "$eq" ,
        "attribute": "PrimaryAddress.ListOfPartySiteUses.SiteUseType",
        "value": "BILL_TO"}
}

Querying Nested List Attributes

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries

Example Request Payload

{   "entity" : "Account",
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "q":
        {"op": "$eq" ,
        "attribute": "ListOfAddresses.City",
        "value": "REDWOOD SHORES"}
}