Select to view content in your preferred language

Set Portal ItemID to specific value

2272
7
06-21-2018 01:35 PM
TobiasFimpel
Regular Contributor

Is it possible to change the ItemID of a Portal Item (e.g. a webmap) to a specific value, or to set a specific ItemID when creating a new item? I don't see any API supporting that so I assume it isn't possible...is my assumption correct?

Tags (1)
0 Kudos
7 Replies
DanielUrbach
Deactivated User

Hello Tobias!

You are correct, it is not possible to specify an itemID or modify an existing one, although I do see some potential value in doing so for certain use cases.

If it does not already exist, I would recommend posting an idea for this here on GeoNet.

-Danny

0 Kudos
SimonSchütte_ct
MVP Regular Contributor

Here is an update

/addItem: Add Item—ArcGIS REST APIs | ArcGIS Developers

itemIdToCreate

New at 10.8.1. The item ID of the item. The item ID must not exist and must be 32 alphanumeric values.

Note:

itemIdToCreate applies only to ArcGIS Enterprise.

Example

itemIdToCreate=832157e321df46f721f9ededbe34ac58


Allows to specify the ItemID to Create:

SimonSchtte_ct_1-1687866190323.png

 

/portal/sharing/rest/content/users/siteadmin/addItem

DanCopKac
Frequent Contributor

This doesnt seem to be working for me in Enterprise 11+. I'm trying to add a new feature service and it just blatantly ignores my itemIdToCreate, which I know for a fact is valid, because the itemId came from my dev portal. 

Ok I see now that if you specify dataUrl then it doesnt work. 

0 Kudos
SimonSchütte_ct
MVP Regular Contributor

Hosted or referenced feature Service? For hosted Services, you can upload the SD file, if I remember correctly. If it is a referenced Feature Service, my workflow is to publish it using the SD file, create an "empty" portal Item with intended ID, then copy the properties from the auto-generated item from the publishing step into the new item. Maybe there is a better way to do it, but it works for me.
/addItem: Add Item | ArcGIS REST APIs | ArcGIS Developers
Items and item types | ArcGIS REST APIs | ArcGIS Developers

Try this:
- go to the /addItem Endpoint
- URL: set a placeholder URL
- Title: some unique Title
- Type: Map Service
- ItemId to Create: set something like 113a4502954a46ec6f06f6a7ac8f6cb9
When clicking on Add Item, now the "empty" item with the intended ID is created. More information/data can be added.
You can then use the items/113a4502954a46ec6f06f6a7ac8f6cb9 endpoints to update the item or delete it.

DanCopKac
Frequent Contributor

@SimonSchütte_ct Referenced/Registered services.

And what do you do with the lingering Portal Item that gets created when originally publishing the service? It seems like it's tied to the service, ie, deleting the original Portal Item deletes the service as well. 

You can create a service without a Portal Item on standalone (not federated), but once the ArcGIS Server Site is federated, the option seems to disappear. 

0 Kudos
SimonSchütte_ct
MVP Regular Contributor

@DanCopKac You need to tie the service to the new item by changing the portal item id in the service properties of the server admin endpoint 🙂
The full workflow requires multiple steps, but can be done. (The portal item references the underlying ArcGIS Server service by URL, the ArcGIS Server service references the Portal Item by portal ID)
(Note: in ArcGIS Enterprise 10.9.1 there is a display bug in the server admin endpoint that will show the old itemid in the public endpoint of the service even if it has been changed to the new item id in the admin. endpoint. Fixed in 11.x)

0 Kudos
JessicaJackson
Occasional Contributor

Hi @SimonSchütte_ct , 

Thank you for this! It worked for me. 

In my case, I needed to recreate a map application with a certain ID (QR codes with the old link were printed on trail signs all around the city).

Just to expand on what has already been posted: I created a map application with what I needed (replica). I copied the json from /portal/sharing/rest/content/items/<<replica id>>/data and saved to a json file. I pasted the json in the Text field of /addItem, set Type to "Web Mapping Application", and entered the old ItemId.  

Edited to add version: 11.1.