SOLVED

Re: Leads by Filter Type

Go to solution
Anonymous
Not applicable

Leads by Filter Type

I am trying to write a C# code to extract Leads by filterType. Here is the sample code I am referring to.

https://github.com/Marketo/REST-Sample-Code/blob/master/c%23/LeadDatabase/Leads/GetLeadsByFilterType...

the example says filter type is email but I have to change it as UpdatedAt. The below link says the Date range filter should specify a start and End limit using a JSON format

http://developers.marketo.com/rest-api/bulk-extract/bulk-lead-extract/

Has anyone tried using the filter? how would the JSON format be defined in C#?

Regards,

Sampada

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Leads by Filter Type

Please show exactly what you're sending and how it differs from the Bulk Extract example. I don't understand what you're trying.

Note updatedAt may not be available in your instance for Bulk Extract. When available it's used exactly as you would use createdAt, which I feel is shown clearly enough in the example in the docs.

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Leads by Filter Type

You're mixing together different endpoints. The Bulk Extract API has almost nothing in common with other APIs, so don't take your guidance from there.

You can't use updatedAt as a filterType for /rest/v1/leads.json. As the docs state:

The lead field to filter on. Custom fields (string, email, integer), and the following field types are supported: id, cookies, email, twitterId, facebookId, linkedInId, sfdcAccountId, sfdcContactId, sfdcLeadId, sfdcLeadOwnerId, sfdcOpptyId.

Please explain exactly what you're trying to return from the database.

Anonymous
Not applicable

Re: Leads by Filter Type

Thanks. I now understand the difference. Could you help with the link below.

It has a similar syntax - bulk/v1/leads/export and the Body shows with FilterType as CreatedAt

http://developers.marketo.com/rest-api/bulk-extract/

SanfordWhiteman
Level 10 - Community Moderator

Re: Leads by Filter Type

Please show exactly what you're sending and how it differs from the Bulk Extract example. I don't understand what you're trying.

Note updatedAt may not be available in your instance for Bulk Extract. When available it's used exactly as you would use createdAt, which I feel is shown clearly enough in the example in the docs.

Anonymous
Not applicable

Re: Leads by Filter Type

while creating the JSON Body is the order of parameters important?

Example : I am making a bulk call for activities tables as shown in this link (http://developers.marketo.com/rest-api/bulk-extract/bulk-activity-extract/#filters ) where the Create Job Body shows parameters as

{
   "format": "CSV",
   "filter": {
      "createdAt": {
         "startAt": "2017-07-01T23:59:59-00:00",
         "endAt": "2017-07-31T23:59:59-00:00"
      },
      "activityTypeIds": [
         1,
         12,
         13
      ]
   }
}

the body of my program is

{
"filter":{
"createdAt":{
  "startAt":"2018-02-01T05:00:00Z",
  "endAt":"2018-02-02T05:00:00Z"
},
"activityTypeId":[
  1,
  2,
  3
  ]
},
"format":"CSV"
}

The format parameter in my code appears at the end. Does that affect anything? The problem I am facing with my code is the activityTypeId filter is ignored and I get the output with all Ids.

SanfordWhiteman
Level 10 - Community Moderator

Re: Leads by Filter Type

The order is not important but the spelling certainly is. You have a typo in activityTypeId.

Anonymous
Not applicable

Re: Leads by Filter Type

Thank you for that. One character missed screws up things.