I'm very new to Marketo. I'm a Salesforce developer wanting to use the Marketo API to get data. From Salesforce, I want to query Marketo for customer responses for a date period (today) for a specific campaign. I've gotten as far as creating the Apex class to call Marketo and successfully connecting and calling the LeadKey() method. However, I can't seem to find a method to do what I would call a "SOQL" query. Anybody got suggestions or examples? Thanks! Frank
SQL style query is not supported. You will need to use the available SOAP calls at http://developers.marketo.com/documentation/soap/
Also, there is no straight up call to get campaign results using a camnpaignID. You will need to use the getLeadChanges call (http://developers.marketo.com/documentation/soap/getleadchanges/) . In the sample call response on this page, you will notice that there is an attribute that looks like this:
<campaign>Japanese form fillout.test time zone</campaign>
The name is in the form of <Program Name>.<Campaign Name> and you will need to parse this value to find the activities resulted from a campaign.
Calvin, thanks for your response, it helped. I got the calls working fine, but I've run into two problems that I can't resolve: 1) Calling getLeadChanges, since it is so large, exceeds the HTTP Callout limit of 10 by Salesforce 1b) I see the Campaign I need in the changes, but not fields I need!
2) I tried to call getLeadActivity since that is only for one lead. But that occassionally exceeded the HTTP Callout limit also! 2b) The fields I need are not there.
I guess the most important thing is figure out how to get the fields I need. They are two custom fields, UUID and UUID Status. If I could narrow the search to only these two field and for only the campaign I need, that would be perfect. Is that possible?
I thought you were looking for activities specifically related to the campaign such as "Send Email" or "Change Data Value". If you just want custom field value on a per lead basis, then all you need to do is call getLead - http://developers.marketo.com/documentation/soap/getlead/
However, it sounds like you are looking for a Smart Campaign that changed the data value of some IDs. In this case, you will use getLeadActivity or getLeadChanges narrowing down the response to the "Change Data Value" activity only. Below is a snippet of the filter in XML for "getLeadActivity":
In addition, you can use batch size or other date filters such as activityCreatedAt to narrow down the response even more. When you page through the result set, each http callout can give you up to 2 minutes so it shouldn't exceed the timeout limit - http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_callouts_timeouts.htm
If you are still having trouble with this, submit a support case to us and we will help you from there.