Query Saved Searches Using Get Operations

In the following document we will go over different individual parameters on Get operation to query overriding a saved search. You can query for Saved Searches by either using the Saved Search number of the saved search or by using the QueryUuid. You must specifiy the entity when querying for Saved Searches.

Querying Saved Searches using Saved Search Number

The below example show how you can query a Saved Search using the Saved Search number.

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/59783e65-0513-4169-9fae-db9d7d1b105c?metaModelUuid=81f4c054-90c6-45a0-a096-beec3ad68d42&entity=Account&savedSearchNumber=889937479

Example Response Payload

{   
    "name":"Parser",
    "entity":"Account",
    "keywords":"parser",
    "sort": [{ "attribute":"PartyUniqueName","direction":"ascending"}],
    "fields":["PartyUniqueName","PrimaryAddress"],
    "q":{"op": "$all" , "attribute": "PartyUniqueName", "value": "Technologies United"},
    "excludeFields" : ["PrimaryIndustry"],
    "aggregations":{
        "CreationDate":{
            "range":{
                "attribute":"CreationDate",
                "ranges":[
                    {"key": "ThisQuarter", "from": "now/m-3m", "to": "now"},
                    {"key": "NextQuarter", "from": "now", "to": "now/m+3m"},
                    {"key": "ThisYear", "from": "now/y", "to": "now/y+1y"},
                    {"key": "LastQuarter", "from": "now/m-6m", "to": "now/m-3m"},
                    {"key": "LastYear", "from": "now/y-1y", "to": "now/y"}
                ]
            }
        }
    },
    "keywordsFields":["PrimaryIndustry"]
}

Querying Saved Searches using QueryUuid

How to set a limit to the number of data rows to retrieve.

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/59783e65-0513-4169-9fae-db9d7d1b105c/results?entity=Account&limit=3

Example Response Payload

{
    "items": [
        {
            "PreferredFunctionalCurrency_localizedValue": null,
            "PrimaryIndustry": {
                "ClassCode": "2000",
                "CodeAssignmentId": 300100169114658,
                "Primary": true,
                "ClassCode_localizedValue": "Industrial Manufacturing"
            },
            "PartyRecordSet_localizedValue": null,
            "PreferredFunctionalCurrency": null,
            "MinorityOwnedType": null,
            "ListOfContacts": null,
            "PrimaryPhone": null,
            "PartyNumber": null,
            "LegalStatus_localizedValue": null,
            "LastUpdateDate": null,
            "EmployeesAtPrimaryAddress": null,
            "DomesticUltimateDUNSNumberC": null,
            "CurrentFiscalYearPotentialRevenueAmount": null,
            "ListOfResourceIdsInTheManagementChainOfAResourceForTheTeam": null,
            "_entity": "Account",
            "ListOfResourceIdsForTheTeam": null,
            "CeoName": null,
            "PrimaryEmail": null,
            "OrganizationSize": null,
            "LastUpdatedBy": null,
            "ListOfIndustries": null,
            "DbRating": null,
            "PartyRecordSet": null,
            "ParentDUNSNumberC": null,
            "PrimaryIM": null,
            "ListOfOrganizationTypes": null,
            "OrganizationName": null,
            "ObjectVersionNumber": null,
            "LaborSurplusInd": null,
            "ListOfResourceIdsThatAreOwnersOfAnAssociatedTerritory": null,
            "LegalStatus": null,
            "NamedFlag": null,
            "PrimaryContact": null,
            "OrganizationProfileId": null,
            "JgzzFiscalCode": null,
            "GlobalUltimateDUNSNumberC": null,
            "PartyId": 300100169114649,
            "OwnerPartyId": null,
            "OrganizationSize_localizedValue": null,
            "SalesProfileType_localizedValue": null,
            "PartyUniqueName": "3M (St. Paul, US)",
            "IncorpYear": null,
            "ListOfResourceIdsThatAreMembersOfATerritoryThatIsAnAncestorOfAnAssociatedTerritory": null,
            "ListOfResourceIdsThatAreMembersOfAnAssociatedTerritory": null,
            "ListOfResourceIdsInTheManagementChainOfTheOwner": null,
            "ExportInd": null,
            "SalesProfileType": null,
            "ImportInd": null,
            "PrimaryOrganizationType": null,
            "DUNSNumberC": null,
            "EmployeesTotal": null,
            "PrimaryAddress": {
                "CountryCode_localizedValue": "United States",
                "PostalCode": "55144",
                "State": "MN",
                "Address1": "3M Center",
                "CountryCode": "US",
                "CurrencyCode": "USD",
                "OverallPrimary": true,
                "City": "St. Paul",
                "FormattedAddress": "3M Center,ST. PAUL, MN 55144",
                "PartySiteId": 300100169114653,
                "IdentifyingAddressFlag": true,
                "ListOfPartySiteUses": [
                    {
                        "PrimaryPerType": true,
                        "SiteUseType_localizedValue": "Bill to",
                        "PartySiteUseId": 300100169114654,
                        "SiteUseType": "BILL_TO"
                    },
                    {
                        "PrimaryPerType": true,
                        "SiteUseType_localizedValue": "Business",
                        "PartySiteUseId": 300100169114655,
                        "SiteUseType": "BUSINESS"
                    }
                ]
            },
            "Owner": {
                "PartyId": 100010025532672
            },
            "ListOfPhones": null,
            "EmployeesAtPrimaryAddressEstimation_localizedValue": null,
            "ListOfAddresses": null,
            "EmployeesAtPrimaryAddressEstimation": null,
            "ListOfTerritories": null,
            "PrimaryURL": null,
            "Disadv8aInd": null,
            "ListOfResourcesForTheTeam": null,
            "ListOfIMs": null,
            "CreationDate": null,
            "CurrencyCode": null,
            "SalesProfileStatus_localizedValue": null,
            "LineOfBusiness": null,
            "SalesProfileStatus": null,
            "ListOfURLs": null,
            "ListOfTerritoryIds": null,
            "ListOfEmails": null,
            "EnquiryDUNS": null,
            "CreatedBy": null,
            "SalesAccountId": null,
            "CurrencyCode_localizedValue": null,
            "ListOfTerritoryIdsThatAreAncestorsOfAnAssociatedTerritory": null,
            "links": [
                {
                    "rel": "self",
                    "href": "https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/59783e65-0513-4169-9fae-db9d7d1b105c/results/300100169114649?limit=2&entity=Account",
                    "kind": "item",
                    "name": "self"
                },
                {
                    "rel": "canonical",
                    "href": "https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/entities/Account/300100169114649?limit=2",
                    "kind": "item",
                    "name": "canonical"
                },
                {
                    "rel": "parent",
                    "href": "https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/59783e65-0513-4169-9fae-db9d7d1b105c/results?entity=Account",
                    "kind": "collection",
                    "name": "parent"
                }
            ]
        },
...
}

Fields

To specify a list of fields to retrieve in an output payload. We support *(asterisk) based filtering.

cURL Command

https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/59783e65-0513-4169-9fae-db9d7d1b105c/results?entity=Account&offset=3&fields=PartyUniqueName

Example Response Payload

{
    "items": [
        {
            "_entity": "Account",
            "PartyUniqueName": "~RESTOppAccName~ (New York, US)",
            "PartyId": 300100264860806,
            "links": [
                {
                    "rel": "canonical",
                    "href": "https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/entities/Account/300100264860806?metaModelUuid=81f4c054-90c6-45a0-a096-beec3ad68d42&entity=Account&fields=PartyUniqueName",
                    "kind": "item",
                    "name": "canonical"
                },
                {
                    "rel": "self",
                    "href": "https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/59783e65-0513-4169-9fae-db9d7d1b105c/results/300100264860806?metaModelUuid=81f4c054-90c6-45a0-a096-beec3ad68d42&entity=Account&fields=PartyUniqueName",
                    "kind": "item",
                    "name": "self"
                },
                {
                    "rel": "parent",
                    "href": "https://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/59783e65-0513-4169-9fae-db9d7d1b105c/results?metaModelUuid=81f4c054-90c6-45a0-a096-beec3ad68d42&entity=Account",
                    "kind": "collection",
                    "name": "parent"
                }
            ]
        },
...
}