Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get events within a group/subgroup #14

Closed
mpucherSmIT opened this issue Jun 5, 2022 · 11 comments
Closed

How to get events within a group/subgroup #14

mpucherSmIT opened this issue Jun 5, 2022 · 11 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@mpucherSmIT
Copy link

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
Copy link
Owner

Olen commented Jun 5, 2022

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.

@mpucherSmIT
Copy link
Author

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 :-)

@mpucherSmIT
Copy link
Author

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

@elliot-100
Copy link
Collaborator

elliot-100 commented Jun 14, 2022

[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.

@elliot-100
Copy link
Collaborator

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

@elliot-100
Copy link
Collaborator

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...

@mpucherSmIT
Copy link
Author

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

@elliot-100
Copy link
Collaborator

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

@elliot-100 elliot-100 added the question Further information is requested label Sep 28, 2022
@elliot-100
Copy link
Collaborator

elliot-100 commented Oct 7, 2022

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.

@elliot-100 elliot-100 added the enhancement New feature or request label Oct 7, 2022
@elliot-100 elliot-100 changed the title How to get events within a group How to get events within a group/subgroup Oct 7, 2022
@elliot-100
Copy link
Collaborator

I will add subgroup_id parameter to get_events() shortly.

@elliot-100 elliot-100 self-assigned this Jul 28, 2023
@elliot-100 elliot-100 removed their assignment Apr 25, 2024
@elliot-100 elliot-100 self-assigned this May 20, 2024
@elliot-100
Copy link
Collaborator

Closed by #114 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants