Olen/Spond

How to get events within a group/subgroup

Closed this issue · 11 comments

Hello and thank you for your great work so far. It seems more people aren't that happy with the export functionalities spond provides ;-)

We have a large children group that has training events and I'de like to export those events per month (with participants). getEvents and getEventsBetween seem to only load "global" events.

Is it possible to fetch events per (sub-)group? I'm digging around dev tools and try to get something like that:

https://spond.com/api/2.1/group/{our_group_id}/ -> lists members so the correct id is used
https://spond.com/api/2.1/group/{our_group_id}/sponds -> 404
https://spond.com/api/2.1/group/{our_group_id}/events -> 404
https://spond.com/api/2.1/sponds/?group={our_group_id} -> param is ignored

Any other ideas?

Olen commented

Not sure it is possible, but if you find something interessting, please let me know.

It will fetch all events you are invited to or you are the organiser of, and I guess you can find which (sub) group that it includes by looking at who is invited and do some filtering based on that.

Hi Olen,

just a few minutes ago i figured it out. Or better said firefox web developer tools provides way more information then chrome ;-)

Firefox showed me a bunch new url parameters:

https://spond.com/api/2.1/sponds?addProfileInfo=true&excludeAvailability=false&excludeRepeating=false&groupId=YOUR_GROUP_ID&includeComments=false&includeHidden=true&max=20&minEndTimestamp=2022-06-04T22:00:00.001Z&minStartTimestamp=2022-07-08T14:00:00Z&order=asc&prevId=blah&scheduled=true

And it provides lots of data :-)

One could even call subgroup events with the subGroupId param. Not sure what prevId is for because I couldn'f find that id in our data. Maybe it is for navigation or similar.

image

[getEvents]

...will fetch all events you are invited to or you are the organiser of

I think it'll also fetch all events within groups for which you have a defined ('admin') role. Not sure how role permissions affect this.

@mpucherSmIT - wondering if you've done any development on this?

I have written an enhancement to get events per group. But it seems to have exposed an unexpected problem that the existing code which doesn't include a GroupId parameter fails to get a a few events per group.

I will share an informal test as soon as feasible...

Hi @elliot-100,

here is the code snippet that I added to spond.py:

async def getGroupEventsBetween(self, start_time, end_time, groupId, subGroupId): if not self.cookie: await self.login() url = self.apiurl + "sponds?addProfileInfo=true&excludeAvailability=false&excludeRepeating=false&groupId=" + groupid + "&subGroupId=" + subGroupId+ "&includeComments=false&includeHidden=true&includeCancelled=false&max=500&minEndTimestamp=" + start_time + "T00:00:00.001Z&maxEndTimestamp="+ end_time + "T00:00:00.001Z&order=asc&scheduled=true" async with self.clientsession.get(url) as r: self.events = await r.json() return self.events

Thanks - I haven't forgotten about this, but other things have got in the way...

Hi, added group_id parameter to a new, generalised get_events(), now released in v0.9.0.
Haven't yet added subgroup_id or other parameters, partly as I am not sure I have enough real data to do any level of assurance.

But I think we are now in a better position if you would like to add?
Otherwise I'l probably add as and when they are useful to me.

I will add subgroup_id parameter to get_events() shortly.

Closed by #114 .