Get All campaigns sent since April 1st 2019

I need to retrieve all campaigns that were sent since month of April. I have looked into using the V3 API but all I found there was the https://:account.api-us1.com/api/3/campaigns?orders[cdate]=DESC. I’ve tried using but if I try to sort by cdate field it doesn’t work.

Then I found in version 1 of the api campaign_paginator. However, here there is very little explanation on how to use the sort and filter fields to get the data that I want. For sorting it says to use 01 or 01D where number represents the column, but what column is that? It doesn’t list you all the columns anywhere nor their corresponding ids. I decided to try and map it against the campaign page you get when you go via their admin panel but for that the Send Date is column 02. If I put 02 or 02D I always get the same results.

As for how to use the filter field, I am completely lost there as all it says is: The section filter that should be applied. This corresponds to a unique ID in the sectionfilter database table. Example: 11

What is a section filter?

Bottom line is, I’m looking for help on which API to call and what paremeters I would pass to retrieve all campaigns that were sent as of April 1st 2019. How can I do this via API?

Hi there, Amy from ActiveCampaign’s Customer Experience Team. We’re just refreshing our forum page and I wanted to add some help here for anyone who comes across this page/question/post.

You can use the V1 API’s campaign_paginator endpoint with appropriate sorting and filtering parameters.

First, let’s address the sorting and filtering parameters:

  • Sorting: You mentioned using 01 or 01D for sorting, but it seems that it doesn’t correspond to the send date. The sorting parameter 01 might correspond to the campaign ID in the database, not the send date. We need to find the correct column ID for the send date.
  • Filtering: The filter parameter allows you to specify conditions for filtering campaigns. For your requirement, you’ll need to filter campaigns based on their send date.

Now, here’s how you can approach this:

  1. Find the correct column ID for the send date: As you mentioned, the send date column in the campaign page of the admin panel corresponds to column 02. We’ll use this information.
  2. Construct the filter parameter: Since we want campaigns sent since April 1st, 2019, we’ll construct a filter that checks for send dates greater than or equal to April 1st, 2019.
  3. Make the API call with the appropriate parameters.

Here’s an example of how to construct the API call:

GET /campaign_paginator?sort=02D&filter=&search=&offset=0&limit=100

Explanation of parameters:

  • sort=02D: Sort the campaigns in descending order based on the send date (column 02).
  • filter=: No specific filter applied in this case.
  • search=: No specific search query.
  • offset=0: Start retrieving campaigns from the first page.
  • limit=100: Retrieve up to 100 campaigns per page. Adjust this value as needed.

After retrieving the campaigns, you can iterate over the results and filter out campaigns sent since April 1st, 2019, based on their send date.

Please note that the campaign_paginator endpoint might have limitations in terms of filtering and sorting compared to the V3 API.

Alternatively, using V3 API, you can achieve this by using the /campaigns endpoint along with filtering and sorting parameters. However, it’s important to note that the V3 API may not provide as granular control over filtering and sorting as the V1 API.

To retrieve campaigns sent since April 1st, 2019, using the V3 API, you can use the sent_at filter parameter along with sorting. Here’s how you can construct the API call:

GET /campaigns?filters[status]=sent&filters[sent_at]=AFTER:2019-04-01T00:00:00Z&sort=created_at:DESC

Explanation of parameters:

  • filters[status]=sent: Filters campaigns to only include those that have been sent.
  • filters[sent_at]=AFTER:2019-04-01T00:00:00Z: Filters campaigns to include only those sent after April 1st, 2019. Adjust the date and time as needed.
  • sort=created_at:DESC: Sorts the campaigns in descending order based on their creation date. You can change created_at to sent_at if you prefer to sort by the send date.

Ensure that you replace placeholders such as 2019-04-01T00:00:00Z with the appropriate date and time in ISO 8601 format.

Any questions or additional ideas, thread them below!