Colum Creed
I want to use the api to get events for more than one group. If I run it for the groups individually, I get the results back.
For example:
...../api/xm/1/events?targetedRecipients=677e461f-d32d-40ff-bb23-f15d10eaaad1&embed=properties
If I try it with 2 groups separated by a comma I get no events back. Both groups have events within the last 30 days
...../api/xm/1/events?targetedRecipients=677e461f-d32d-40ff-bb23-f15d10eaaad1,b000cb43-e78d-4ccb-ae52-339e65a76a80&embed=properties
Is it possible to return results for more than one group in the same call?
0
Comments
Please sign in to leave a comment.
I tried it and was unsuccessful as well, not sure if it's possible. Here's a quick script you could use as a basis to pull this off though, or something similar to what you need I think.
You'd have to run it in flow designer or modify to be run outside of it.
Thanks Michael. It is helpful to have this as an option and I appreciate the code. I have users who want to be able to pull the event data directly into excel without writing code.
Excel can get data through an api call and load it into columns without users having to write code to parse the JSON result. Once you have the spreadsheet created, you can "refresh" to pull in the data without having to modify the call. The workaround is to create a separate call for each group. That is easy enough to do. However, the api documentation indicates you can have more than one "targetedRecipients" if the recipients are users so I assumed it would work if the "targetedRecipients" were groups.
For reference, here is how to make an api call from excel:
Data=> Get Data=>From web
Enter the url (and first time through authentication credentials) and hit ok
This will bring you into the Power Query editor
Click on "List" to the right of Data. Then click on "Convert to Table". Hit OK.
One column will be displayed.
Click on the icon top right of column with a left and right arrow.
Select the fields you want and click OK.
Some fields, like properties, have nested fields so you can drill down to get as much or as little as you want. Columns with the left and right arrow indicates the column has nested data.
When done click "Close and Load".
Voila! you have the data. Right click to refresh.
Hi Colum
If you include more than 1 recipient in your query then both recipients would need to be part of the event for it to be returned.
This is an "and" not an "or" call.
I believe you would need multiple calls to get the different events for the different groups. We can certainly look to log a product enhancement if you believe this would be something to include in the product.
Thanks
Hi Colum,
Thanks for the question, and sharing the use case. As Daniel and Michael pointed out, the only way to get events per group is to make separate API calls.
The parameter will accept a comma delimited list, but it will return events that have targeted all of the specified recipients i.e. the logical AND operation.
Thanks,
Craig
Thanks for all the comments. I now understand why I don't get any results when I put 2 groups in the call. It all makes sense when you understand it is "AND" logic being applied not "OR" logic.