Skip To Content

/import: Import Group Content

  • URL:https://[root]/community/groups/[groupID]/import(POST only)
  • Required Capability:Administrator | Group Owner
  • Version Introduced:10.8.1

Example usage

The following is a sample ArcGIS Enterprise POST request for the import operation:


POST /webadaptor/sharing/rest/community/groups/d9151a601867423cab48b3e2d60e105f/import HTTP/1.1
Host: machine.domain.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryZu1ZLNLoz0r07YNm

------WebKitFormBoundarycnhdXN08VxWWOPxq
Content-Disposition: form-data; name="itemId"

668d62829b5c4035bc94c7456159018a
------WebKitFormBoundarycnhdXN08VxWWOPxq
Content-Disposition: form-data; name="itemIdList"


------WebKitFormBoundarycnhdXN08VxWWOPxq
Content-Disposition: form-data; name="folderId"


------WebKitFormBoundarycnhdXN08VxWWOPxq
Content-Disposition: form-data; name="folderOwnerUsername"


------WebKitFormBoundarycnhdXN08VxWWOPxq
Content-Disposition: form-data; name="f"

pjson
------WebKitFormBoundarycnhdXN08VxWWOPxq--

Description

Note:

This operation is only supported in ArcGIS Enterprise.

The import operation imports supported content items from an export package (generated using the export operation) into the selected group. To call this operation, the export package must first be added to the receiving environment using the Add Item operation, as the import operation will not upload the export package to the organization. When the items are imported, their item IDs are maintained and URLs are updated to reflect the new environment. Once the items have been imported successfully, the export package will be deleted. It is important to note that the receiving organization must be using the same version (or later) of ArcGIS Enterprise as the environment where the export package was generated.

Note:

This operation is also supported for groups that had the Shared updates designation set during group creation.

Request parameters

ParameterDetails
itemId

The item ID of the export package. Before calling this operation, the export package must be added to the receiving organization using the Add Item operation. The resulting item ID will be used as the value for this parameter.

itemIdList

(Optional)

A comma-separated list of item IDs included in the export package. By default, the system will attempt to import all supported items included in the export package. If item IDs are specified in this parameter, the system will instead only attempt to import those specific items.

previewOnly

If true, the import is not performed. Instead, a summary of what is included in the export package is returned.

Values: true | false

overwriteExistingItems

If true, and the item exists within the importing organization, the existing item will be overwritten with the corresponding item in the export package.

Values: true | false

async

If true, the job is run asynchronously and the response returns job details.

Values: true | false

folderId

(Optional)

Introduced at 10.9. It designates the destination folder for the imported items.

folderOwnerUsername

(Optional)

Introduced at 10.9. It specifies the username of the folder's owner.

f

The response format. The default format is html.

Values: html | json | pjson

Upload .epk item to receiving environment

To upload the export package to the receiving environment, you must use addItem and, at minimum, define the title, type, typeKeywords, and tags in the request:


POST /webadaptor/sharing/rest/content/users/userID/addItem HTTP/1.1
Host: machine.domain.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryFxWOiSZOhHdxL2Zg

------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="file"; filename=""
Content-Type: application/octet-stream

Test_2020531_102838.epk
------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="url"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="text"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="dataUrl"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="title"

Test Export Package
------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="thumbnail"; filename=""
Content-Type: application/octet-stream


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="thumbnailUrl"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="metadata"; filename=""
Content-Type: application/octet-stream


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="type"

Export Package
------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="categories"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="typeKeywords"

Export Package,epk
------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="description"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="tags"

epk
------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="snippet"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="licenseinfo"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="culture"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="properties"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="extent"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="callback.html"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="originItemId"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="destinationItemId"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="relationshipTypes"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="serviceUsername"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="servicePassword"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="serviceCredentialsType"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="serviceProxyParams"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="serviceProxyFilter"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg
Content-Disposition: form-data; name="appCategories"


------WebKitFormBoundaryFxWOiSZOhHdxL2Zg

The response from this request is demonstrated below. The id will be added as the value for itemId when the import operation is called.


{
  "success": true,
  "id": "668d62829b5c4035bc94c7456159018a",
  "folder": null
}

Additional example usage

Below is a sample POST request that demonstrates how to preview the contents of an export package before performing the import operation:


POST /webadaptor/sharing/rest/community/groups/d9151a601867423cab48b3e2d60e105f/import HTTP/1.1
Host: machine.domain.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryZu1ZLNLoz0r07YNm

------WebKitFormBoundaryZu1ZLNLoz0r07YNm
Content-Disposition: form-data; name="itemId"

668d62829b5c4035bc94c7456159018a
------WebKitFormBoundaryZu1ZLNLoz0r07YNm
Content-Disposition: form-data; name="itemIdList"


------WebKitFormBoundaryZu1ZLNLoz0r07YNm
Content-Disposition: form-data; name="previewOnly"

true
------WebKitFormBoundaryZu1ZLNLoz0r07YNm
Content-Disposition: form-data; name="folderId"


------WebKitFormBoundaryZu1ZLNLoz0r07YNm
Content-Disposition: form-data; name="folderOwnerUsername"


------WebKitFormBoundaryZu1ZLNLoz0r07YNm
Content-Disposition: form-data; name="f"

pjson
------WebKitFormBoundaryZu1ZLNLoz0r07YNm--
Note:

When the previewOnly parameter is true, the job path will be updated to the following: https://machine.domain.com/webadaptor/community/groups/ d9151a601867423cab48b3e2d60e105f/importPreview/69867fb59ac84a8d847442e232d43277?f=json&start=1&num=25. The default values for start is 1 and num is 25. You will be able to pass different start and num parameter values to page through the preview results.

Accessing results

If async is true, asynchronous job details are returned for this operation:


{
  "jobId": "ff84f1e4646e4d4c9464c5476b699735",
  "key": "BvOoz3Xnp13qWhR69g7ltU2ilqE1KarXZcPROHxpwsU="
}

Group owners attempting to import group content, but who are not administrators, must use both the jobID and key values to check the job's results and status using the following URL format:

https://machine.domain.com/webadaptor/sharing/rest/portals/<orgID>/jobs/<jobID>?key=<keyValue>

Administrators can check the job's results and status using the jobID value in the following URL format:

https://machine.domain.com/webadaptor/sharing/rest/portals/<orgID>/jobs/<jobID>

If successful, a success response will be returned containing an assortment of itemID elements for each published item and other job information. The published items will be placed in a folder, named after the group, in the user's content. The published items can also be found on the Group Content resource page.

JSON Response examples

Below is a response example demonstrating the preview function:


{
  "packageSummary": {
    "id": "69867fb59ac84a8d847442e232d43277",
    "fileName": "Test_2020531_102838",
    "packageVersion": "1.0",
    "packageCreated": 1590989318963,
    "sourcePortalInfo": {
      "httpsUrl": "https://machine.domain.com/webadaptor",
      "httpUrl": "http://machine.domain.com/webadaptor",
      "version": "10.8.1",
      "portalId": "d65a043d-2d49-492e-ab1e-4f87a92c6e1b",
      "isPortal": true
    }
  },
  "total": 3,
  "start": 1,
  "num": 3,
  "nextStart": -1,
  "results": [
    {
      "id": "4a0fe3a6f8c3432490822a7ccffc6602",
      "type": "Shapefile",
      "title": "example shape file",
      "size": 5369,
      "exists": false,
      "canImport": true,
      "created": 1590673414612,
      "modified": 1590673414612
    },
    {
      "id": "6a05e1064c2848918059a849a300d509",
      "type": "Web Map",
      "title": "example web map",
      "size": 3228,
      "exists": false,
      "canImport": true,
      "created": 1590673580319,
      "modified": 1590673585488
    },
    {
      "id": "2aba832a4afa429d886d8d8c8f6fbede",
      "type": "Feature Service",
      "title": "example hosted feature service",
      "size": 5369,
      "exists": false,
      "canImport": true,
      "created": 1590673414796,
      "modified": 1590673439011
    }
  ]
}

Below is a sample response for the import operation run synchronously:


{
  "result": {
    "itemsImported": [
      {
        "itemId": "4a0fe3a6f8c3432490822a7ccffc6602"
      },
      {
        "itemId": "2aba832a4afa429d886d8d8c8f6fbede"
      },
      {
        "itemId": "6a05e1064c2848918059a849a300d509"
      }
    ],
    "itemsSkipped": [],
    "itemsFailedImport": []
  }
}

Below is a sample response returned via the job page when import is run asynchronously:


{
  "id": "ff84f1e4646e4d4c9464c5476b699735",
  "definition": {
    "type": "import",
    "itemId": "69867fb59ac84a8d847442e232d43277",
    "groupId": "142b3c7995ec447288f15db4d301fe53",
    "groupTitle": "myGroup"
  },
  "status": "completed",
  "created": 1586902163432,
  "modified": 1586902163592,
  "messages": [
    "Starting import of items from EPK item '69867fb59ac84a8d847442e232d43277' to group 'myGroup'.",
    "Starting the import of exported package item '69867fb59ac84a8d847442e232d43277' containing 3 items.",
    "Import option to overwrite items if they exist is set to 'true'."
  ],
  "result": {
    "itemsImported": [
      {
        "itemId": "4a0fe3a6f8c3432490822a7ccffc6602"
      },
      {
        "itemId": "2aba832a4afa429d886d8d8c8f6fbede"
      },
      {
        "itemId": "6a05e1064c2848918059a849a300d509",
      }
    ],
    "itemsSkipped": [],
    "itemsFailedImport": []
  }
}