How to retrieve all mailing lists created in a given Directory - API V3 | XM Community
Solved

How to retrieve all mailing lists created in a given Directory - API V3

  • 16 September 2019
  • 4 replies
  • 92 views

Hi,
Here is my use case:
I've created XM DIRECTORY MAILING LISTS and use the tag ownerId to put a group library id => in order to share my mailing lists.
I now want to retrieve all those mailing list with a simple get call: https://---.eu.qualtrics.com/API/v3/directories/POOL_xxxxxxxxxx/mailinglists

When i do that the response does not return the created mailing lists and i cannot understand why

Can you please help?

Thanks in advance
icon

Best answer by Bhushan 16 September 2019, 16:56

View original

4 replies

Badge +1
Hi @josi972 ,

If your mailing list is shared then this API call will not work.

Thanks,
Bhushan
So is there any way to do that? because in fact those mailing are shared
You may have to use the Research Core API (https://finnair.eu.qualtrics.com/API/v3/mailinglists) to get all lists, this should return all lists, but without any metadata which is super painful.

The directory API gives more useful information about each list, but not for the shared lists, this is so ...... :s
Figured this topic would be suitable for an additional question about retrieving all mailing lists using pagination.
API "List Mailing Lists" states that the result.nextPage should provide offset value automaticly (default 0), or atleast thats how I understand it, although it returns url without offset. I tested using this new url but It took me nowhere.
I make the API curl call using adobe campaign (JavaScript) where I have a function for checking if there actually is a new page available and a function that executes the curl call with new url.
My goal is simply to go through all the lists but I'm able to retrieve only the first 100.

function executeNewUrl(url){
var command = "curl --silent --output -X GET -H 'X-API-TOKEN: "+vars.subsKey+"' '"+url+"'";
var result = execCommand(command);
var itemsObj = JSON.parse(result[1]);
if (itemObj.toString() != "undefined");{
for (var i=0; i < itemsObj.result.elements.length; i++){
logInfo("nimi: "+itemsObj.result.elements[i].name);
}
checkNextPage(itemsObj); //calls executeNewUrl with new url if nextPage is not null
}
}
Any ideas or experience with similar issues?
Hope you can help,
-M

Leave a Reply