Hey Stephen, thanks again for your reply! And also a late Happy New Year :-)
Am 04.01.24 um 15:20 schrieb Stephen J. Turnbull:
So my main question is now: does anybody know of a possibility with this command to extract only writable attributes!?
If you mean doing this so you can PUT all of those at once, I'm pretty sure it doesn't work that way. PUT creates or replaces a whole object. If there's an existing value with read-only attributes, that's not going to work. It may be possible to specify multiple values to PATCH, but that's beyond my knowledge.
Mh. I tried it this way:
- I curled the config
- tried to PUT it back into another list (didn't work b/c of read-only attributes)
- I deleted all the attributes from the export
- then PUT this file and it worked
-> it only seems crazy to delete all the attributes myself, I would want to curl and save only writable attributes :-)
Getting the config: curl -u restadmin:restpass localhost:8001/3.1/lists/listname.domain/config | jq > listname.domain
Do you need to use curl (or anything other than Python 3) to do your work for some reason? Life is a lot easier if you use mailmanclient.
I don't need to use curl, no. This was just the only way I found till right now to export and reimport the config of a list.
How would this work with mailmanclient? I'v never used it before and didn't find a hop-in for the right usage right away. Could you point me to the right direction or even write some sample-commands to get export and import of a lists config? That would be awesome!
Just tried getting all the members: curl -u restadmin:restpass localhost:8001/3.1/lists/listname.domain/roster/member | jq > listname.domain.members
But putting them back seems to be a different thing: curl -u restadmin:restpass -d @listname.domain.members -H "Content-Type: application/json" -X PUT localhost:8001/3.1/lists/listname.domain/roster/members
Do you mean the difference between roster/member and roster/members? Not sure why the would be, would have to look at the source.
This was abviously my bad. It wasn't about members with s or not -> the right one would always be without: localhost:8001/3.1/lists/listname.domain/roster/member
-> I just tried to export and import members of a list via the API just as I tried with the config. If you know of another way or how this could work, I also would be really glad. (it works with "mailman members $list
textfile" and reimport them via Postorius, I just tried it like that, since on commandline it would be easier for a whole set of lists)
Thanks again and kind regards, Jens.