# ShowPolledData API
This API allows the user to fetch the polled data from a monitor or monitor group for the time period specified by the user.
## Syntax
**API for XML Response:**
```
https://[HOST]:[PORT]/AppManager/xml/ShowPolledData?apikey=[ API Key ]
```
**API for JSON Response:**
```
https://[HOST]:[PORT]/AppManager/json/ShowPolledData?apikey=[ API Key ]
```
**Supported HTTP methods:** GET
**Allowed roles:** Administrator, Operator, User
## Request Parameters
| Field | Description |
|---|---|
| resourceid | This value is the resource ID of the monitor from which the data has to be fetched. |
| attributeID | This is the value of the attribute ID for which the polled or archived data has to be shown. |
| period | The period for which the downtime details have been requested. Possible values are:
- Period : 0 → Today
- Period : 3 → Yesterday
- Period : 6 → This Week
- Period : 1 or -7 → Last 7 days
- Period : 12 → Last Week
- Period : 7 → This Month
- Period : 2 or -30 → Last 30 days
- Period : 11 → Last Month
- Period : 9 → This Quarter
- Period : 8 → This Year
- Period : 5 → Last 1 year
- Period : 20 → Shows all polled data
- Period : 4 → Custom Time Period |
| startDate and endDate | Using these parameters, you can set custom time period for ShowPolledData API. Enter the values for **startDate** and **endDate** in the format **YYYY-MM-DD HH:MM** where HH should be in 24 hour format. To configure custom time period, value for parameter **period** should be set to **4**.
**Note:** Custom Time Period, configured by specifying the value for parameter **period** as **4**, is supported only to retrieve archived data and not for polled data. |
## Sample Request
### Polled Data
**API for XML Response:**
```
https://[HOST]:[PORT]/AppManager/xml/ShowPolledData?apikey=aaaaaabbbbbbccccccddddddeeeeee&resourceid=10000042&period=20&attributeID=310
```
**API for JSON Response:**
```
https://[HOST]:[PORT]/AppManager/json/ShowPolledData?apikey=aaaaaabbbbbbccccccddddddeeeeee&resourceid=10000042&period=20&attributeID=3102
```
### Last 7 days Data
**API for XML Response:**
```
https://[HOST]:[PORT]/AppManager/xml/ShowPolledData?apikey=aaaaaabbbbbbccccccddddddeeeeee&resourceid=10000042&period=-7&attributeID=3102
```
**API for JSON Response:**
```
https://[HOST]:[PORT]/AppManager/json/ShowPolledData?apikey=aaaaaabbbbbbccccccddddddeeeeee&resourceid=10000042&period=-7&attributeID=3102
```
### Last 30 days Data
**API for XML Response:**
```
https://[HOST]:[PORT]/AppManager/xml/ShowPolledData?apikey=aaaaaabbbbbbccccccddddddeeeeee&resourceid=10000042&period=-30&attributeID=3102
```
**API for JSON Response:**
```
https://[HOST]:[PORT]/AppManager/json/ShowPolledData?apikey=aaaaaabbbbbbccccccddddddeeeeee&resourceid=10000042&period=-30&attributeID=3102
```
### Custom Period
**API for XML Response:**
```
https://[HOST]:[PORT]/AppManager/xml/ShowPolledData?apikey=aaaaaabbbbbbccccccddddddeeeeee&resourceid=10000016&attributeID=1938&period=4&startDate=2017-11-06 11:20&endDate=2017-11-16 11:40
```
**API for JSON Response:**
```
https://[HOST]:[PORT]/AppManager/json/ShowPolledData?apikey=aaaaaabbbbbbccccccddddddeeeeee&resourceid=10000016&attributeID=1938&period=4&startDate=2017-11-06 11:20&endDate=2017-11-16 11:40
```
## Response Details
| Field | Description |
|---|---|
| StartTime | This is the start time in milli seconds format from which 7/30/ show polled data report is generated |
| EndTime | This is the end time in milli seconds format from which 7/30/ show polled data report is generated |
| StartDateTime | This is the start time in date time format from which 7/30/ show polled data report is generated |
| EndDateTime | This is the end time in date time format from which 7/30/ show polled data report is generated |
| ResourceName | This is the monitor name from which the data is returned |
| ResourceType | This is the type of the resource for which the data is returned |
| AttributeName | This is the name of the attribute |
| Unit | This is the units of the attribute |
| AttributeID | This is the ID of the user |
| ReportType | This is the type of data this API call is returning (Polled data / 7 days data / 30 days data). |
| BusinessPeriod | This represents the business period name |
| ResourceId | This is the monitor resourceid |
| AttributeImage | This is the attribute graph for the data returned along with this response. |
| Status | This is the status of the REST API call to get the show polled data |
| Period | This value specifies the type of data that needs to be returned. Its values are: 20 for show polled data, -7 for 7 days archived data and -30 for 30 days archived data. |
| RawData | - CollectionTime — represents the time stamp in ms at which the data is collected
- DateTime — represents the time stamp in date time format at which the data is collected
- Value — this represents the value of the attribute |
| ArchiveData | - ArchivedTime — represents the archived time in ms
- DateTime — represents the archived time in date time format
- AvgValue — this is the avg time of the value in that archived period
- MinValue — this is the minimum value in that archived period
- MaxValue — this is the maximum value in that archived period |
## Sample Response
**XML Input:**
```
https://apm-prod-server:8443/AppManager/xml/ShowPolledData?apikey=aaaaaabbbbbbccccccddddddeeeeee&resourceid=20000039&period=20&attributeID=1957
```
**XML Response:**
```xml
```
**JSON Input:**
```
https://apm-prod-server:8443/AppManager/json/ShowPolledData?apikey=aaaaaabbbbbbccccccddddddeeeeee&resourceid=20000039&period=20&attributeID=1957
```
**JSON Response:**
```json
{
"response-code": "4000",
"response": {
"uri": "/AppManager/json/ShowPolledData",
"result": [
{
"StartTime": "1337928634448",
"EndDateTime": "May 25, 2012 3:32 PM",
"ResourceName": "apm-prod1_Windows Vista",
"Unit": "%",
"EndTime": "1337940130413",
"BusinessPeriod": "NA",
"ReportType": "Polled data",
"ThresholdDetails": [],
"ResourceId": "20000039",
"AttributeName": "CPU Utilization",
"AttributeID": "1957",
"AttributeImage": "/webclient/temp/images/fjrEKg.jpg",
"Status": "SUCCESS",
"RawData": [
{ "CollectionTime": "1337940130413", "Value": "18", "DateTime": "May 25, 2012 3:32 PM" },
{ "CollectionTime": "1337939525577", "Value": "11", "DateTime": "May 25, 2012 3:22 PM" },
{ "CollectionTime": "1337938920641", "Value": "5", "DateTime": "May 25, 2012 3:12 PM" },
{ "CollectionTime": "1337938315808", "Value": "6", "DateTime": "May 25, 2012 3:01 PM" },
{ "CollectionTime": "1337937710788", "Value": "7", "DateTime": "May 25, 2012 2:51 PM" },
{ "CollectionTime": "1337937105838", "Value": "7", "DateTime": "May 25, 2012 2:41 PM" },
{ "CollectionTime": "1337936500971", "Value": "9", "DateTime": "May 25, 2012 2:31 PM" },
{ "CollectionTime": "1337935895963", "Value": "18", "DateTime": "May 25, 2012 2:21 PM" },
{ "CollectionTime": "1337935291160", "Value": "7", "DateTime": "May 25, 2012 2:11 PM" },
{ "CollectionTime": "1337934686297", "Value": "31", "DateTime": "May 25, 2012 2:01 PM" },
{ "CollectionTime": "1337934079880", "Value": "13", "DateTime": "May 25, 2012 1:51 PM" },
{ "CollectionTime": "1337933475084", "Value": "16", "DateTime": "May 25, 2012 1:41 PM" },
{ "CollectionTime": "1337932869853", "Value": "34", "DateTime": "May 25, 2012 1:31 PM" },
{ "CollectionTime": "1337932263739", "Value": "8", "DateTime": "May 25, 2012 1:21 PM" },
{ "CollectionTime": "1337931658583", "Value": "7", "DateTime": "May 25, 2012 1:10 PM" },
{ "CollectionTime": "1337931053751", "Value": "17", "DateTime": "May 25, 2012 1:00 PM" },
{ "CollectionTime": "1337930448921", "Value": "9", "DateTime": "May 25, 2012 12:50 PM" },
{ "CollectionTime": "1337929844110", "Value": "6", "DateTime": "May 25, 2012 12:40 PM" },
{ "CollectionTime": "1337929239270", "Value": "3", "DateTime": "May 25, 2012 12:30 PM" },
{ "CollectionTime": "1337928634448", "Value": "9", "DateTime": "May 25, 2012 12:20 PM" }
],
"ResourceType": "Windows Vista",
"StartDateTime": "May 25, 2012 12:20 PM",
"Period": "20"
}
]
}
}
```