Skip To Content
ArcGIS Developer
Dashboard

Edit Usage Report

Description

The edit operation modifies a usage report. To edit a usage report, you need to submit the complete JSON representation of the usage report, which includes updates to the usage report properties. The name of the report cannot be changed when editing the usage report.

Request parameters

ParameterDetails
reportname

The unique name of the report. The name must remain the same when editing.

Example

"reportname": "Server Statistics"
since

The time duration for the report. CUSTOM represents a time range that is specified using the from and to parameters.

Values: LAST_DAY (previous 24 hours) | LAST_WEEK (previous 7 days) | LAST_MONTH (previous 30 days) | LAST_YEAR (previous 365 days) | CUSTOM

from

(Optional, used if since is set to CUSTOM)

The timestamp (milliseconds since UNIX epoch, namely January 1, 1970, 00:00:00 GMT) for the beginning period of the report.

Example

"from": 1568314393298
to

(Optional, used if since is set to CUSTOM)

The timestamp (milliseconds since UNIX epoch, namely January 1, 1970, 00:00:00 GMT) for the ending period of the report.

Example

"to": 1568185200000
aggregationInterval

(Optional)

Aggregation interval in minutes. Server metrics are aggregated and returned for time slices aggregated using the specified aggregation interval. The time range for the report, specified using the since parameter (and from and to when since is CUSTOM) is split into multiple slices, each covering an aggregation interval. Server metrics are then aggregated for each time slice and returned as data points in the report data. When the aggregationInterval is not specified, the following defaults are used:

  • LAST_DAY: 30 minutes
  • LAST_WEEK: 4 hours
  • LAST_MONTH: 24 hours
  • LAST_YEAR: 1 week
  • CUSTOM: 30 minutes up to 1 day, 4 hours up to 1 week, 1 day up to 30 days, and 1 week for longer periods.
Note:

If the samplingInterval specified in Usage Reports Settings is more than the aggregationInterval, the samplingInterval is used instead.

queries

A list of queries for which to generate the report. You need to specify the list as an array of JSON objects representing the queries. Each query specifies the list of metrics to be queries for a given set of resourceURIs.

Example

"queries": [
  {
    "resourceURIs": [
      "services/Map_bv_999.MapServer"
    ],
    "metrics": [
      "RequestCount"
    ]
  }
]
metadata

Can be any JSON Object. Typically used for storing presentation tier data for the usage report, such as report title, colors, line-styles, and so on.

Example

"metadata": "This could be any String or JSON Object, typically used for storing report metadata."
f

The response format. The default response format is html.

Values: html | json | pjson

Query parameters

PropertyDescription
resourceURIs

Comma separated list of resource URIs for which to report metrics. Specifies services or folders for which to gather metrics. The resourceURI is formatted as follows:

  • services/—Entire site
  • services/Folder/—Folder in a site. Reports metrics aggregated across all services in that folder and subfolders.
  • services/Folder/ServiceName.ServiceType—Service in a specified folder, for example, services/Map_bv_999.MapServer
  • services/ServiceName.ServiceType—Service in the root folder, for example, Map_bv_999.MapServer

Example

"resourceURIs": [
  "services/SampleWorldCities.MapServer", 
  "services/System"
]
metrics

Comma separated list of metrics to be reported. Supported metrics are as follows:

  • RequestCount—Number of requests received
  • RequestsFailed—Number of requests that failed
  • RequestsTimedOut—Number of requests that timed out
  • RequestMaxResponseTime—Maximum response time
  • RequestAvgResponseTime—Average response time
  • ServiceRunningInstancesMax—Maximum number of active (running) service instances sampled at one-minute intervals for a specified service
Note:

The RequestsTimedOut and ServiceRunningInstancesMax metrics are not applicable to hosted feature services.

Example

"metrics": [
  "RequestCount",
  "RequestsFailed"
]

Example usage

Request JSON syntax

{
  "reportname": [unique name or id of the report],
  "since": [" LAST_DAY | LAST_WEEK | LAST_MONTH | CUSTOM"],
  "from" : [timestamp],  //Optional, specified when "since" is CUSTOM
  "to": [timestamp],  //Optional, specified when "since" is CUSTOM
  "aggregationInterval": [minutes],  //Optional, aggregation interval in minutes
  "queries": [
    {
      "resourceURIs": ["services/Map_bv_999.MapServer"], //Comma separated list of services and/or folders
      "metrics": ["RequestCount"] // Comma separated list of metrics
    }
  ],
  "metadata": "This could be any String or JSON Object."
}

Single query example

Below is a sample POST request for edit that demonstrates a single query. This example is formatted for readability:

POST /webadaptor/admin/usagereports/1394219221008/edit HTTP/1.1
Host: machine.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

usagereport={
  "reportname": 1394219221008,
  "since": "LAST_MONTH",
  "queries": [
    {
      "resourceURIs": [
        "services/Map_bv_999.MapServer"
      ],
      "metrics": [
        "RequestCount"
      ]
    }
  ],
  "metadata": "This could be any String or JSON Object, typically used for storing report metadata."
}&f=json

Multiple queries example

Below is a sample POST request for edit that demonstrates multiple queries. This example is formatted for readability:

POST /webadaptor/admin/usagereports/Server Statistics/edit HTTP/1.1
Host: machine.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

usagereport={
  "reportname": "Server Statistics",
  "since": "LAST_WEEK",
  "aggregationInterval": 5,
  "queries": [
    {
      "resourceURIs": [
        "services/SampleWorldCities.MapServer", 
        "services/System"
      ],
      "metrics": [
        "RequestCount",
        "RequestsFailed"
      ]
    },
    {
      "resourceURIs": [
        "services/System/CachingTools.GPServer"
      ],
      "metrics": [
        "RequestAvgResponseTime",
        "RequestsTimedOut"
      ]
    }
  ],
  "metadata": "This is a random test String that could contain report metadata in any format"
}&f=json

JSON Response example

{"status": "success"}