[Resolved] Request members+mail-addresses from external script

First of all: Thanks for nextcloud, I am quite amazed how many well thought-through features it offers.

I am thinking about configuring my mail server to make a forward to all members of nextcloud-group. For that I’d like to get the members and addresses with a cron job (on the system where nextcloud is installed.)

Can you give me any hints on how to query the list of group members? Do I have to do an own SQL-Query directly to the backend? (I guess I won’t get an API stability guarantees for that.) Or is there some (REST-)API to request the information I am looking for? I don’t expect the specific request as an answer just a general direction in which I should be looking would suffice.

I am also open for any reasons why this is a bad idea and better solutions.

Thanks for the help in advance!

A friend gave me the following idea:

Request the users with occ group:list and then get their addresses via occ user:info. Both with --output json or whatever I want to process in my script.

That works very well for my use case. Leaving it here if someone else needs to do this.