/addResources: Add Resources

URL:
https://[root]/content/users/[userName]/items/[itemID]/addResources
Methods:
POST

Example usage

Use dark colors for code blocksCopy
1
https://www.arcgis.com/sharing/rest/content/users/jsmith/items/0c66beb52dff4994be67937cdadbdbf1/addResources

Description

The add resources operation (POST only) allows to add new file resources to an existing item, for example, an image that is used as custom logo for Report Template. All the files are added to resources folder of the item. File resources use storage space from your quota and are scanned for viruses. The item size is updated to include the size of added resource files. There is a limit of 1000 files per item (except Style items). A maximum of 50 files can be added each request. Each file should be no more than 50 Mb. Each file should have a different filename. The maximum size of all of the file resources for an item is 10 GB.

Supported item types that allow adding file resources are:

  • AppBuilder Widget Package
  • Application
  • Application Configuration
  • ArcGIS Pro Add In
  • Code Attachment
  • Data Store
  • Desktop Application
  • Feature Service
  • Geocoding Service
  • Geoprocessing Service
  • Hub Initiative
  • Hub Page
  • Hub Site Application
  • Image Service
  • Map Service
  • Mobile Application
  • Native Application
  • Native Application Installer
  • Native Application Template
  • Notebook
  • Notebook Code Snippet Library
  • Report Template
  • Rule Package
  • Scene Service
  • Site Application
  • Site Page
  • Solution
  • SQLite Geodatabase
  • Statistical Data Collection
  • StoryMap
  • Style
  • Vector Tile Package
  • Vector Tile Service
  • Web Mapping Application
  • Web Map
  • Web Scene
  • WFS

Supported file formats are:

  • .json
  • .xml
  • .txt
  • .png
  • .pbf
  • .zip
  • .jpeg
  • .jpg
  • .gif
  • .bmp
  • .gz
  • .svg
  • .svgz
  • .geodatabase
  • .glb (added at ArcGIS Enterprise 10.9)
  • .stylx (added at ArcGIS Enterprise 10.9)
  • .pdf (added at ArcGIS Enterprise 10.9)
  • .wav (added at ArcGIS Enterprise 10.9)
  • .webp (added at ArcGIS Enterprise 10.9)
  • .webm (added at ArcGIS Enterprise 10.9)

File resources must be updated in an HTTP multi-part request pursuant to IETF RFC1867.

The operation is only available to the item owner, organization administrator and members of the group with item update capability.

Request parameters

ParameterDetails

[Common Parameters]

For a complete listing, see Common parameters.

file

Multi-part HTTP parameter containing the binary file to upload.

resourcesPrefix

(Optional)

A prefix string added to the fileName in the storage. The added files can be accessed from either:
https://[root]/content/items/[itemID]/resources/<resourcesPrefix>/<resourcename> or
https://[root]/content/users/[userName]/items/[itemID]/resources/<resourcesPrefix>/<resourcename>.

fileName

(Optional)

File name used to rename an existing file resource uploaded, or to be used together with text as file name for it. File name must have the file resource extension.

Example: Banner.jpg

text

(Optional)

Text input to be added as a file resource, used together with fileName.

archive

(Optional)

If true, file resources added are extracted and files are uploaded to respective folders. access parameter will be ignored when archive is true, file resources will have inherit access. Th default value is false.

Values: true | false

access

(Optional)

Set file resource to be private regardless of the item access level, or revert it by setting it to inherit which makes the item resource have the same access as the item.

Values: private | inherit.

f

The response format. The default format is html.

Values: html | json | pjson

Response properties

PropertyDetails

success

Indicates if the operation was successful.

itemId

The ID of the item that file resources were added to.

owner

The owner of the item.

folder

The ID of the folder where the item is, null if the item is in the root folder.

JSON Response syntax

Use dark colors for code blocksCopy
1
2
3
4
5
6
{
  "success": true,
  "itemId": "<item id>",
  "owner": "<owner username>",
  "folder": "<folder id>"
}

JSON Response example

Example one

The example below demonstrates the response returned when the request has been executed successfully:

Use dark colors for code blocksCopy
1
2
3
4
5
6
{
  "success": true,
  "itemId": "0c66beb52dff4994be67937cdadbdbf1",
  "owner": "jsmith",
  "folder": null
}

Example two

The example below demonstrates the error response returned when an incorrect file type is passed in the request:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
{
  "error": {
    "code": 400,
    "messageCode": "CONT_0093",
    "message": "File type not allowed for addResources",
    "details": []
  }
}

Example three

The example below demonstrates an error response returned when the file upload amount (50 files per request) is exceeded:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
{
  "error": {
    "code": 400,
    "messageCode": "CONT_00945",
    "message": "Exceeded total number of files for this resource",
    "details" : [ ]
  }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.