Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: PortalItem

dojo.require("esri.arcgis.PortalItem")

Description

(Added at v2.8)
An item (a unit of content) in the Portal. Each item has a unique identifier and a well known url that is independent of the user owning the item. An item may have associated binary or textual data which is available via the item data resource. View the ArcGIS Portal API REST documentation for the item for more details.

Samples

Search for samples that use this class.

Properties

NameTypeSummary
accessStringIndicates the level of access: private, shared, org, or public.
accessInformationStringInformation on the source of the item.
avgRatingNumberAverage rating.
createdDateThe date the item was created.
cultureStringThe item locale information (language and country).
descriptionStringThe detailed description of the item.
extentObjectThe bounding rectangle of the item.
idStringThe unique id for this item.
itemDataUrlStringThe url to the data resource associated with the item.
itemUrlStringThe url to the item.
licenseInfoStringAny license information or restrictions.
modifiedDateDate the item was last modified.
nameStringThe name of the item.
numCommentsNumberNumber of comments on the item.
numRatingsNumberNumber of ratings on the item.
numViewsNumberNumber of views on the item.
ownerStringThe username of the user who owns this item.
portalPortalThe portal that contains the item.
sizeNumberThe size of the item.
snippetStringA summary description of the item.
spatialReferenceStringThe item's coordinate system.
tagsString[]User defined tags that describe the item.
thumbnailUrlStringThe url to the thumbnail used for the item.
titleStringThe title for the item.
typeStringThe gis content type of this item.
typeKeywordsString[]A set of keywords that further describes the type of this item.
urlStringThe url for the resource represented by the item.
userItemUrlStringThe url to the user item.

Methods

NameReturn typeSummary
addComment(comment)DeferredAdd a comment to the item.
addRating(rating)DeferredAdd a rating to an item that you have access to.
deleteComment(comment)DeferredDeletes an item comment.
deleteRating()DeferredDelete a rating that you created for the specified item.
getComments()DeferredGet the comments associated with the item.
getRating()DeferredReturns the rating (if any) given to the item.
getThumbnailUrl(width?)StringGet the URL to the thumbnail image for the portal item.
updateComment(comment)DeferredUpdates an item comment.
Property Details

<String> access

Indicates the level of access: private, shared, org, or public.

<String> accessInformation

Information on the source of the item.

<Number> avgRating

Average rating. Uses a weighted average called "Bayesian average".

<Date> created

The date the item was created.

<String> culture

The item locale information (language and country).

<String> description

The detailed description of the item.

<Object> extent

The bounding rectangle of the item. It is returned as an extent object with the following format:
   "extent": [  [
        minX,
        minY
      ],
      [
        maxX,
        maxY
      ]
    ]

<String> id

The unique id for this item.

<String> itemDataUrl

The url to the data resource associated with the item.

<String> itemUrl

The url to the item.

<String> licenseInfo

Any license information or restrictions.

<Date> modified

Date the item was last modified.

<String> name

The name of the item.

<Number> numComments

Number of comments on the item.

<Number> numRatings

Number of ratings on the item.

<Number> numViews

Number of views on the item.

<String> owner

The username of the user who owns this item.

<Portal> portal

The portal that contains the item.

<Number> size

The size of the item.

<String> snippet

A summary description of the item.

<String> spatialReference

The item's coordinate system.

<String[]> tags

User defined tags that describe the item.

<String> thumbnailUrl

The url to the thumbnail used for the item.

<String> title

The title for the item. This is the name that is displayed to users and by which they refer to the item. Every item must have a title.

<String> type

The gis content type of this item. Example types include : "Web Map" and "Web Mapping Application".

<String[]> typeKeywords

A set of keywords that further describes the type of this item. Each item is tagged with a set of type keywords that are derived based on its primary type.

<String> url

The url for the resource represented by the item.

<String> userItemUrl

The url to the user item.
Method Details

addComment(comment)

Add a comment to the item. Only available for authenticated users who have access to the item. Returns a deferred that when resolved provides access to a PortalComment object.
Return type: Deferred
Parameters:
<String> comment Required The text for the comment.
Sample:
portalItem.addComment('This is a really cool application.');

addRating(rating)

Add a rating to an item that you have access to. Only 1 rating can be given to an item per user. If this call is made on an already rated item, the new rating will overwrite the current one. A user cannot rate their own item. Available only to authenticated users. Returns a deferred that when resolved provides access to a PortalRating object.
Return type: Deferred
Parameters:
<Number> rating Required Rating to set for the item. Rating must be a number between 1.0 and 5.0.

deleteComment(comment)

Deletes an item comment. Only available to the authenticated user who created the comment.
Return type: Deferred
Parameters:
<PortalComment> comment Required The PortalComment to delete.

deleteRating()

Delete a rating that you created for the specified item. Returns a deferred that when resolved provides access to a PortalRating object.
Return type: Deferred

getComments()

Get the comments associated with the item. Returns a deferred that when resolved provides access to an array of PortalComment objects.
Return type: Deferred
Sample:
portalItem.getComments().forEach(function(result){
  console.log(result.comment);
});

getRating()

Returns the rating (if any) given to the item. Returns a deferred that when resolved provides access to a PortalRating object.
Return type: Deferred

getThumbnailUrl(width?)

Get the URL to the thumbnail image for the portal item.

Available width sizes: 200, 400, 800 and 2400. (Added at v3.21)
Return type: String
Parameters:
<Number> width Optional The desired image width.

updateComment(comment)

Updates an item comment. Only available to the authenticated user who created the comment.
Return type: Deferred
Parameters:
<PortalComment> comment Required A PortalComment that contains the comment updates.
Show Modal