ArcREST icon indicating copy to clipboard operation
ArcREST copied to clipboard

Q: get Group object(s) by title?

Open sloanlance opened this issue 8 years ago • 0 comments

I'm not sure whether opening an issue here is the right thing to do to request support for ArcREST. If I should ask questions somewhere else, please let me know where that is. I believe https://developers.arcgis.com/python/ is not the right place, because that seems to be all about the other "arcgis" Python package, not ArcREST.

When I want to get an ArcGIS group by title, I've been using these lines of code:

def getGroupByTitle(community, title):
    groupIDs = community.getGroupIDs(groupNames=title)
    if len(groupIDs) > 0:
        return community.groups.group(groupId=groupIDs[0])
    return None

Is there a better way than this that already exists?

I hoped I could do something like this instead:

def getGroupByTitle(community, title):
    return community.groups.search(q=title)

That works, but it doesn't return a Group object as the first example does. This one returns basic Python data structures. I could use that, but it's more convenient to work with the established classes.

Also, since I need to get information about several groups, I'd like to optimize the queries. That is, I'd like get several Group objects by passing in a list of IDs. Hopefully that would generate as few requests to the REST API as possible (maybe just one request if the number of IDs is small), but even if it wasn't, if ArcREST could contain the looping, that would be nice.

💡 If these features aren't already available, it would be great if they could be added in a future version.

ArcRest or ArcRestHelper

ArcREST

Version or date of download

Either of:

  • "master" branch of https://github.com/Esri/ArcREST.git
  • "ArcREST_Package 3.5.6" from https://pypi.python.org/pypi/ArcREST_Package

Bug or Enhancement

💡 Enhancement (possibly)

Repo Steps or Enhancement details

sloanlance avatar Aug 29 '16 16:08 sloanlance