Disclaimer: I haven't used this particular API before.
let
iterations = 150,
url = "https://Your Qualtrics Data Center Here.qualtrics.com/API/v3/mailinglists/*Mailing List ID Here/contacts",
FnGetOnePage = (url) =>
let
Source = Json.Document(Web.Contents(url, [Headers=[#"X-API-TOKEN"="Your API token here**"]])),
data = try Source[result][elements] otherwise null,
next = try Source[result][nextPage] otherwise null,
res = [Data=data, Next=next]
in
res,
GeneratedList =
List.Generate(
()=>[i=0, res = FnGetOnePage(url)],
each [i]<iterations and [res][Data]<>null,
each [i=[i]+1, res = FnGetOnePage([res][Next])],
each [res][Data])
in
GeneratedList
Enter your data center, mailing list ID ad API token in the spots indicated. This API will bring in up to 15,000 contacts (150 iterations * 100 records per page). If you need to bring in more than 15,000 contacts, simply increase the number of iterations in the second line.
Hello,
The above power query script looks just like what I need, but I can't get it to work on my mailing list. Does this still work for other people?
I made the updates to datacenter, mailing list ID, and the API-token (and also to the line "each [i]null" which appears to be a typo).
All I get for output is 150 null records, and nothing at all if I filter out nulls. Does that mean that I'm just not connecting? I'm not getting any error messages.
Any kind of help would be greatly appreciated!
The code I used (except the API token and mailing list ID) is below.
let
iterations = 150,
url = "https://iad1.qualtrics.com/API/v3/mailinglists/ML_???/contacts",
FnGetOnePage = (url) =>
let
Source = Json.Document(Web.Contents(url, tHeaders=H#"X-API-TOKEN"="???"]])),
data = try Sourcetresult]celements] otherwise null,
next = try Source=result]unextPage] otherwise null,
res = in
res,
GeneratedList =
List.Generate(
()=>ti=0, res = FnGetOnePage(url)],
each ei]
each eres]sData])
in
GeneratedList
Hi All,
Came across this and this is really interesting. I ready though that there was a difference between ML_ vs CG_ lists (RC / XM or Shared / Non Shared)? Did anyone get this working?
Thanks
Rod Pestell
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.