reassignItems not working using REST API (also maybe I'm crazy)

388
1
05-03-2023 11:02 AM
AaronCole1
Occasional Contributor

I've been at this in every way imaginable (seemingly) and have determined two things. Thing 1: The ArcGIS API for Python does not work well. Thing 2: The ArcGIS REST API is poorly documented. 

Long story short, all I need to do is automate the task of reassigning content. Simple in concept, not in practice. You can't reassign certain items (Service Definitions) until their dependent items are reassigned, and in other cases, items shared to groups with update capabilities, can't be reassigned until unshared. Ok, I can work around that. Here's the process:

Create dictionary of Item Properties > Unshare Item > Reassign Ownership > Re-share Item

The Python API seems to hang indefinitely when it finds something it doesn't like, where at least with the REST API it will either succeed or fail with an error code that I can handle, so I've rewritten all my code using the REST API directly in Python rather than the Python API itself.  Was this preferred? No. But does it work? Also no.

Moving on, I'm finally at the point where I want to reassign ownership, but the documentation points me to an invalid URL, see: Reassign Items—ArcGIS REST APIs | ArcGIS Developers.  What am I missing here?

I finally have it solved using the following URL (that actually resolves):

sharing_root_url/content/users/<username>/<folder_id>/items/<item_id>/reassign

But...just..why?!? Seems like this should not have taken this long. Portal was supposed to make life easier? LOL. I'm not even asking a question here, just some light venting. Thanks for listening.

0 Kudos
1 Reply
AaronCole1
Occasional Contributor

Apparently I'm too deep down the rabbit hole to notice simple things like the version introduced. Clearly this won't work on 10.9.1. The more you know!

AaronCole1_0-1683142549850.png

 

0 Kudos