- URL: https://<usageReport-url>/edit(POST only)
- Required Capability:Default administrator role
- Version Introduced:10.3
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 its properties. The name of the usage report cannot be changed when editing it.
Request parameters
Parameter | Details |
---|---|
reportname | The unique name of the report. The name must remain the same during editing. Example
|
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 time stamp (milliseconds since UNIX epoch, namely January 1, 1970, 00:00:00 GMT) for the beginning period of the report. Example
|
to (Optional, used if since is set to CUSTOM) | The time stamp (milliseconds since UNIX epoch, namely January 1, 1970, 00:00:00 GMT) for the ending period of the report. Example
|
aggregationInterval (Optional) | The 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 the from and to parameters 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 value is not specified, the following defaults are used:
Note:If the samplingInterval value specified in Usage Reports Settings is more than the aggregationInterval value, the samplingInterval value is used instead. |
queries | A list of queries used to generate the report. 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 values. Example
|
metadata | A JSON object. This is typically used for storing presentation tier data for the usage report, such as report title, colors, line-styles, and so on. Example
|
f | The response format. The default response format is html. Values: html | json | pjson |
Query parameters
Property | Description |
---|---|
resourceURIs | A comma-separated list of resource URIs used to report metrics. This specifies services or folders that are used to gather metrics. The resourceURI is formatted as follows:
Example
|
metrics | A comma-separated list of metrics to be reported. The following are supported metrics:
Note:The RequestsTimedOut and ServiceRunningInstancesMax metrics are not applicable to hosted feature services. Example
|
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
A sample POST request for the edit operation that demonstrates a single query is shown below. 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
A sample POST request for the edit operation that demonstrates multiple queries is shown below. 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"}