ArcGIS REST API

Portal History

Description

Allow organization administrator to query historical events occurred in an ArcGIS Online organization. When output format is CSV, only the first 10000 records can be included.

Request Parameters

ParameterDetails
[Common Parameters]

For a complete listing, see common parameters.

num

The maximum number of history events to be included in each batch of result set. Default is 25, and maximum allowed is 100.

Note that the actual number of returned results may be less than num, this happens when the number of results remaining is less than num.

If output format is CSV (i.e. f=csv), num is the maximum number of total events to be included in the result CSV file (up to 10000 records), start no longer applies.

Example: num=50

start

Used with nextKey from the response to get the next batch of events.

Example: start=eyJjcmVhdGVkIjp7Ik4iOiIxNTM1NjMwMjA1OTI3In0sImlkIjp7IlMiOiIxODhkYzUzMWZkNDI0MWVhYmNhZTllY2ZkNTRjNWU5ZSJ9LCJvcmdJZCI6eyJTIjoiTGtGeXhiOXpEcTd2QU9BbSJ9fQ

all

If true, all types of events are included. Default is false with only actions targeted the organization are included (i.e. idType is a for all events).

id

Filter events by specific target user name or target ID in a batch result set. It can be the ID of an item, a group, a role, a collaboration, an identity provider, etc.

Example: id=jsmith or id=67387f9ead814880bfb1ead7f76e5386

types

Filter events by a comma separated list of target types in a batch result set.

Supported values: a (organization), c (collaboration), cp (collaboration participate), cpg (collaboration participate group), cw (collaboration workspace), cwp (collaboration workspace participate), g (group), i (item), idp (identity provider), inv (invitation), r (role), u (user)

actors

Filter events by a comma separated list of user names who take the actions in a batch result set.

Example: actors=jsmith,kevinb,andrewo

owners

Filter events by a comma separated list of user names who own the action targets in a batch result set.

actions

Filter events by a comma separated list of action types in a batch result set.

Supported Values: add, addusers, create, delete, removeusers, share, unshare, update, login, updateUsers

fromDate

Filter events starting from specific time frame in ISO 8601 format or UNIX time in milliseconds.

Example: fromDate=2017-09-01 or fromDate=1504249200000

toDate

Filter events occurred before specific time frame in ISO 8601 format or UNIX time in milliseconds.

ips

Filter events by a comma separated list of IP addresses in a batch result set.

sortOrder

Describes whether the results return in ascending or descending chronological order. Default is ascending.

Supported values: asc | desc

f

Events output format.

Supported values: json | pjson | csv

Response Properties

PropertyDetails
num

The number of results included in the result set of the response.

Example: num=100

nextKey

Used to fetch the next batch of events by calling with the start parameter.

items

A JSON array of event items, each event is detailed with properties described in the Items Properties section.

Example:

[
    {
      "id": "J423vH8fR9HV444l",
      "idType": "a",
      "orgId": "J423vH8fR9HV444l",
      "created": 1454520118902,
      "actor": "mattp",
      "action": "update",
      "ip": "172.16.254.1",
      "request": "/sharing/rest/portals/self/update",
      "reqId": "e92b4effff914fd68430995c95395b7b",
      "appId": "arcgisonline"
    },
    {
      "id": "J423vH8fR9HV444l",
      "idType": "a",
      "orgId": "J423vH8fR9HV444l",
      "created": 1454524502609,
      "actor": "michaelh",
      "action": "update",
      "ip": "172.16.254.1",
      "request": "/sharing/rest/portals/self/update",
      "reqId": "ac8127b5015b491bb337573c1e7fd2f0"
      "appId": "arcgisonline"
    }]

Items Properties

PropertyDetails
id

Target user name or ID.

idType

The type of the ID in id field.

Values: a (organization) | c (collaboration) | cp (collaboration participate) | cpg (collaboration participate group) | cw (collaboration workspace) | cwp (collaboration workspace participate) | g (group) | i (item) | idp (identity provider) | inv (invitation) | r (role) | u (user)

orgId

Organization ID.

owner

The owner of the target.

created

UNIX timestamp in milliseconds when the event was logged.

actor

The actor of the event.

action

Type of action.

Values: add | addusers | create | delete | removeusers | share | unshare | update | login | updateUsers

ip

Actor's IP address.

request

Operation requested by the actor.

Example: /sharing/rest/content/users/jsmith/shareItems

reqId

Unique identifier used to identify certain event logs together to indicate them as "one action" triggered by the actor, i.e. removing members from a group also unshares their items from the group, or bulk share multiple items altogether.

Example: eb98161d3a8e40fcb71960480f431abb

clientId/appId

ID of the client app where the action was performed on or by the target, i.e. target user signed into ArcGIS Online from ArcGIS Pro.

Example: arcgispro

data

Request parameter information used to take the action where applicable.

Example: {"everyone":false,"org":true,"groups":[]}

Example Usage

URL for Portal History

https://www.arcgis.com/sharing/rest/portals/J423vH8fR9HV444l/history

JSON Response Syntax

{
  "num": <num of results>,
  "nextKey": "<next key>",
  "items": [
    {
      "<event 1 obj>"
    },
    {
      "<event 2 obj>"
    },
    {
      "<event 3 obj>"
    },
    {
      "<event 4 obj>"
    }]}

JSON Response Example

{
  "num": 25,
  "nextKey": "eyJjcmVhdGVkIjp7Ik4iOiIxNTM1NTYxOTU0MzI1In0sImlkIjp7IlMiOiI3ZThmNTM4Zjg2NWE0YWQ4YTlmYTFjODJkNDg3YzEyMyJ9LCJvcmdJZCI6eyJTIjoiSjQyM3ZIOGZSOUhWNDQ0ayJ9fQ",
  "items": [
    {
      "id": "93744920722644fcb926044f2cf327f6",
      "idType": "g",
      "orgId": "J423vH8fR9HV444l",
      "owner": "jsmith",
      "created": 1535671479677,
      "actor": "jsmith",
      "action": "removeusers",
      "ip": "172.16.254.1",
      "request": "/sharing/rest/community/groups/93744920722644fcb926044f2cf327f6/removeUsers",
      "reqId": "563c69aae3474d729aa3db8a4d71a7da",
      "appId": "arcgisonline",
      "data": "{\"users\":[\"[user1, user2, user3, user4]\"]}"
    },
    {
      "id": "7b2a7f54b5e34a6495f4aef3a877d1d3",
      "idType": "i",
      "orgId": "J423vH8fR9HV444l",
      "owner": "user3",
      "created": 1535671479676,
      "actor": "jsmith",
      "action": "unshare",
      "ip": "172.16.254.1",
      "request": "/sharing/rest/community/groups/93744920722644fcb926044f2cf327f6/removeUsers",
      "reqId": "563c69aae3474d729aa3db8a4d71a7da",
      "appId": "arcgisonline",
      "data": "{\"groups\":[\"93744920722644fcb926044f2cf327f6\"]}"
    },
    {
      "id": "c1ef98d5330144f6a76e11c06d64de5d",
      "idType": "i",
      "orgId": "J423vH8fR9HV444l",
      "owner": "jsmith",
      "created": 1535572693781,
      "actor": "jsmith",
      "action": "share",
      "ip": "172.16.254.1",
      "request": "/sharing/rest/content/users/jsmith/shareItems",
      "reqId": "be1f4f2992a34c9f96cdae67137f52a5",
      "appId": "arcgisonline",
      "data": "{\"everyone\":true,\"org\":true,\"groups\":[]}"
    },
    {
      "id": "803c713119084d069c9b2d86575762c7",
      "idType": "i",
      "orgId": "J423vH8fR9HV444l",
      "owner": "jsmith",
      "created": 1535572693781,
      "actor": "jsmith",
      "action": "share",
      "ip": "172.16.254.1",
      "request": "/sharing/rest/content/users/jsmith/shareItems",
      "reqId": "be1f4f2992a34c9f96cdae67137f52a5",
      "appId": "arcgisonline",
      "data": "{\"everyone\":true,\"org\":true,\"groups\":[]}"
    }]}