API request - creating multiple segments/values in a single operation

I'm creating new lists via the API and each list needs to always have the same 5 segments, in this particular case each list has a "Supporter Status" custom field and I have segments for the various supporter states eg "Pending", "Active", "Past".

It seems a bit odd that I have to loop through each segment rule individually adding it one at a time to my newly created list. It means a lot of round trips to your server to set up my segments and a very slow (and more fragile) process as a result.

Ideally the API would allow me to send you an array of segments to add to a list - in the same way I can bulk subscribe a bunch of subscribers in that portion of the API.

The entire process would be much nicer if I could give you a single nested array that defines the list and all it's segments in one hit.

I'm betting that the largest number of segment creation hits to your server are immediately on the heels of a new list being created, being able to create a list with segments from one array and one api call would be far simpler and more robust for client apps and cut back on the API requests for you.

The array syntax would simply be an array of your existing arrays - how much better would the process of setting up a new list (and migrating clients from other systems!) be if you could only do this:

{
    "Title": "Website Subscribers",
    "UnsubscribePage": "http://www.example.com/unsubscribed.html",
    "ConfirmedOptIn": true,
    "ConfirmationSuccessPage": "http://www.example.com/joined.html",
    "CustomFields": [
        {
          "FieldName": "Newsletter Format",
          "DataType": "MultiSelectOne",
          "Options": [ "HTML", "Text" ]
        },
        {
          "FieldName": "Supporter Status",
          "DataType": "Text",
        },    
    ],
    'Segments' : [
        {
          "Title": "Active Supporters",
          "Rules": [
            {
              "Subject": "SupporterStatus",
              "Clauses": ["EQUALS Active"]
            },
          ]
        },
        {
          "Title": "Past Supporters",
          "Rules": [
            {
              "Subject": "SupporterStatus",
              "Clauses": ["EQUALS Past"]
            },
          ]
        },            
    ],    
}

PS If this already works please point me to the API docs for it, because I'm spending a lot of time writing boilerplate code just to create cookie cutter lists!!

Phil Phil, 4 years ago

Hi Benz,

I take your point. For that kind of workflow, having to make multiple calls could be a lengthy process.

I've added your vote to the feature request for copying the structure of an existing list, and also created a new one for the possibility of creating a list along with the entire custom field and segment framework in one call.

In the meantime to cut down on the total round trip time you would probably find that your code would benefit from a degree of parallelism. In a three step process you could:
1. Create the list
2. Create all custom fields in a set of parallel calls
3. Create all segments, also parallel

It's not ideal, but it might bring considerable time savings and get you over the line until we can address your feature requests.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098