Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to pass an Salesforce query through an API Proxy

Hello,

I have an API Proxy which has a salesforce as the backend . I want to pass an salesforce query through the proxy and the query looks like below 

SELECT First_Name, Middle_Name, Last_Name, BirthDate, Email FROM Contact WHERE Active__c = true AND Flight_Role = 'Passenger' AND First_Name != null AND Last_Name != null AND CreatedDate > &LastRunDate .

Can you please help with this.

0 1 112
1 REPLY 1

Hi @Akshaygoli1234 it looks like you want to invoke a SOQL query to Salesforce. In order to do this from and Apigee proxy you just need to pass this query through Apigee. You can either:

  1. Pass the whole json query as is (passthrough) OR 
  2. as a REST parameter in the proxy and then dynamically build the query in Apigee

Depending on your requirements. 

Something like this:

{
    "done" : true,
    "totalSize" : 14,
    "records" : 
    [ 
        {  
            "attributes" : 
            {    
                "type" : "Account",    
                "url" : "/services/data/v62.0/sobjects/Account/001D000000IRFmaIAH"  
            },  
            "Name" : "Test 1"
        }, 
        {  
            "attributes" : 
            {    
                "type" : "Account",    
                "url" : "/services/data/v62.0/sobjects/Account/001D000000IomazIAB"  
            },  
            "Name" : "Test 2"
        }, 

        ...

    ]
}

Check the Salesforce docs for the format required.