I am working on integrating a FileMaker Pro 12 database with MailChimp and need advice on syntax. Following the method of Douglas Alder (
hbase.net) I am reworking and updating the scripts to the v2 API. For the most part it is going smoothly but I hit a snag on the syntax required to encode groups for a subscriber being added via lists/subscribe.format.
FileMaker requires the construction of a URL very similar to that shown in Example 3 of the Serializing Data notes at MailChimp. Example 3, which refers to API 1.3, is:
&apikey=<apikey - captured from your API dashboard>
&id=<list id - captured from lists()>
&email_address=<email_address>
&merge_vars[FNAME]=Firstname
&merge_vars[LNAME]=Lastname
&merge_vars[GROUPINGS][0][name]=Pets
&merge_vars[GROUPINGS][0][groups]=Cat,Dog
&merge_vars[GROUPINGS][1][name]=Food
&merge_vars[GROUPINGS][1][groups]=Meat,Kibble
&output=json
If I read the API v2 notes correctly [groups] is an array in API v2. The question is how to assign an array to second element of Groupings (also an array). Using the format of the example rather than the actual string in FileMaker the URL I tried an expression like so:
apikey=<apikey - captured from your API dashboard>
&id=<list id - captured from lists/list>
&email[email]=<email_address>
&merge_vars[FNAME]=Firstname
&merge_vars[LNAME]=Lastname
&merge_vars[GROUPINGS][0][name]=Pets&
&merge_vars[GROUPINGS][0][groups]=groups[0][groups]=Cat&groups[1][groups]=Dog
&merge_vars[GROUPINGS][1][name]=Food
&merge_vars[GROUPINGS][1][groups]=groups[0][groups]=Meat&groups[1][groups]=Kibble
&double_optin=false&send_welcome=false
The comparable URL in FMP does add the subscriber but does not add the groups to which the subscriber is a member. Can anyone assist in helping with the required syntax for the arrays in Groupings and Groups? I tried several variations but so far nothing records the group data in MailChimp.
Many thanks.
Background.