5 Replies Latest reply on Feb 17, 2017 12:52 AM by f0b6f989f8ce4dc18e7728adbf988e673b5d7149

    export leads that have not unsubscribed using rest api

      I'm unable to export leads using /rest/v1/leads.json that have unsubscribed.

      I keep receiving an error message that filtertype of Unsubscribe is not supported.

       

      Can someone help explain how to go about performing a REST API export of non-unsubscribed leads please, or point out what I might be doing wrong?

      As far as code I have been using existing examples, and can poll the interface.  However I find the use of the leads export functions very limiting at the moment.

       

      Thanks.

        • Re: export leads that have not unsubscribed using rest api
          Jim Thao

          It's because the unsubscribe field is a boolean field.  I would recommend to review this page: http://developers.marketo.com/rest-api/lead-database/leads/#describe

           

          Here's a copypasta for the section that refers to your questions:

           

          Get Leads by Filter Type will return the same type of records, but may return up to 300 per page.  It requires the filterType and filterValues query parameters.

          filterType will accept any non-boolean field to filter on, which you can list using the aforementioned Describe method.  When searching by custom field, only the following data types are supported: string, email, integer.

          filterValues will accept up to 300 values in comma-separated format. The call will search for records where the lead’s field matches one of the included filterValues.  If the number of leads matching the lead filter is greater than 1,000 an error is returned: “1003, Too many results match the filter”.

          One way to go about it is to create a string field and have it populated via a smart campaign by referencing the unsubscribe field.  EG. If Unsubscribe = True then CDV for said field with "Unsubscribed" or some variation of that.   Then, field on that field in your REST call.  You're going to need to build in logic to manage this smart campaign too because if some records subscribes again, you're going to want to update that field.