It cant be and/or, it has to the AND. You will first need to create a sample definition in which you’ll enter the filters and the sampling criteria. Then you take the sample definition id and call the create sample api specifying the mailing list.
The filtering details on the api page maybe a little lacking, therefore my preferred method is to create a sample using the GUI using my desired filters. Then get the sample definition of that sample. Extact the filters from there and go from there.
Thank you, that was very helpful. I was using both in the proper way, maybe something was off with my criteria that led to zero contacts in the sample. I was thrown too by having criteria required in both places. (I understand how that is useful, just that in this case, I only needed one filter.)
The way the API generated sample displays in the GUI is a little odd as well. It implies that there are criteria, and that you can remove them. But you can’t see what they are. ¯\_(ツ)_/¯
One follow up question - is it just me or does the filter in the second call, Create Sample, have no effect on the sample? I essentially get 100% of what’s in the sample definition, no matter what.
The sample definition operates at the directory level. The create sample call operates at the mailing list level (specified by the parentId value).
The additional filters in the create sample call are for you ease and they’ll filter the sample further.
For example, if you have a sample definition that for high value customer where the amount spent is greater than 5K. You could generate a monthly sample that would use the sample definition id, but specify an additional filter of the last transaction being in the last 30 days.
I’ve been successful filtering in the definition, but not the with the sample call. Results are the same regardless of the sample call filter…
For my current needs I only need to get one to work, so I’ll probably set it aside for now.