Access Control List REST API respone

  • 1
  • Question
  • Updated 11 months ago
I am using the following REST API:
https://account.sf-api.com/sf/v3/AccessControls?$expand=Principal
Is the returned list result always in a particular order?

Can we choose what the return list will be sorted by? like by their creation time? Or name? Or ID?

I tried to use $orderby query parameter and so far I have no luck.

Any help will be greatly appreciated.


Thanks,
Jonah
Photo of Jonah

Jonah

  • 20 Posts
  • 1 Reply Like

Posted 11 months ago

  • 1
Photo of Eliezer Encarnacion

Eliezer Encarnacion, Official Rep

  • 732 Posts
  • 102 Reply Likes
Jonah,

The following request to order by Id works for me: GET /sf/v3/Items(id)/AccessControls?$orderBy=Id. If you're trying to order by the properties of the expanded "Principal" I believe that is not possible, but I can always double check.

Eli
Photo of Jonah

Jonah

  • 20 Posts
  • 1 Reply Like
Hi Eli,

Thanks for the response.

So it seems we can only sort by the top level properties like Id, url for access control list objects?
And the top level properties have to be what actually get returned? There is no way to sort by their creation time in case as I do not see that property... Even though that is what I want the list to be sorted by...
Photo of Eliezer Encarnacion

Eliezer Encarnacion, Official Rep

  • 732 Posts
  • 102 Reply Likes
Jonah,

There is always a single owner of a folder; even if the original owner is deleted, the delete process will reassign that folder to a new user selected during the delete process. The AccessControls model exposes an "IsOwner" property that identifies this principal. Use the following request to always get back the single owner for a folder

GET /sf/v3/Items(id)/AccessControls?$filter=IsOwner eq true 

Let me know if that works,

Thanks!
Eli
Photo of Jonah

Jonah

  • 20 Posts
  • 1 Reply Like
Hi Eli,
What I observed is that there can be potentially more than one owner for a folder thus from the ACL list returned, I have to pick one as the primary to show...

There can be more than one ACL object whose isOwner is true.

Is this a bug or please clarify how I can find the only owner of a folder which will simply my solution a lot!


Thanks,
Jonah
Photo of Eliezer Encarnacion

Eliezer Encarnacion, Official Rep

  • 732 Posts
  • 102 Reply Likes
Definitely sounds like a bug, there should be a single owner per Folder. Can you provide me the following info so I can look into it further?:

- Your account subdomain
- Folder id showing 2 or more owners
- Any information you may have about the lifetime of that folder (was it reassigned by a deletion, etc.)

Thanks,
Eli
Photo of Jonah

Jonah

  • 20 Posts
  • 1 Reply Like
Hi Eli,

I found the info that you were looking for
Is there a way like thru email that I can send them over to you with a bit more description?


Thanks,
Jonah
Photo of Eliezer Encarnacion

Eliezer Encarnacion, Official Rep

  • 732 Posts
  • 102 Reply Likes
Just emailed you