I hope the subject captures what I’m trying to do, which is to use an API call (REST, not PHP, if that’s important) to find what Sites an account has a role in. I tried putting a site_permission_user_id parameter in the querystring and also tried mushing together properties in a tree like site_permission[0][user][id] and no dice with either. Do I need the o: in there somewhere?
Unless something’s undocumented or I’m misreading API Reference - Omeka S Developer Documentation, I’m out of luck.
(For what it’s worth, I’m trying to get a list of Site managers as a sufficient proxy for “people I need to talk to about our coming Omeka version upgrade”.)
Hi @triplingual ,
It looks like this is working for me with this approach, but you would have to make a call for each of your sites (updating the site_permission_site_id parameter with the site id).
I make a call to /api/users with the following GET parameters:
key_identity: *****
key_credential: *****
site_permission_site_id: 1
Full URL: api/users?key_identity=*****&key_credential=*****&site_permission_site_id=1
and it returns an array of users:
[
{
"@context": "*****/api-context",
"@id": "******/api/users/1",
"@type": "o:User",
"o:id": 1,
"o:name": "Jon Fackrell",
"o:email": "jon.fackrell@example.com",
"o:created": "2024-12-03T06:28:43+00:00",
"o:role": "global_admin",
"o:is_active": true
}
]
Yeah the trick here is basically that the filter works the other way: it lets you find the users that have a role in a given site. Going the other way, the easiest option is probably to use the sites endpoint: the output for each site includes the users with assigned permissions.
Thanks, both. It looks like this will need to be a chained approach, but hopefully I can write something once and be able to maintain it. @jflatnes I’m not seeing much doco for the sites endpoint in the official API Reference. I can live with only an option to iterate through the sites, but am I just missing documentation?