Monday, August 3, 2015

ArcREST (v3 beta) manageorg update

On the current master branch, the ArcREST team is up to some good old fashion reworking in the hopes of making life a bit easier when working with portal and AGOL.

In today's push (8/3/2015). The big update is the manageorg sub package is changed to make the user's content iterable.

Let's check out an example:

import arcrest
admin = arcrest.manageorg.Administration(url=url,
                                         securityHandler=sh)
user = admin.content.users.user("ARandomUserAccount")
for item in user.items:
    print item.id, item.access, item.owner, item.ownerFolder
    for k in item:
        print k
You'll notice two really interesting things. We are accessing a site with a token handler sh, then we use the for loop syntax to loop through all the items in the root folder. Also, the UserItem object, which is returned from the iterator off of user.items also returns Key/Value pairs from the raw JSON. This means you can get really find grained information from the object, not just what is stubbed out in the class objects. I would like some feedback on this. It was tons of code changes, and wanted to make sure I didn't drop any functions anyone really needed. Enjoy!