Skip to main content
Version: 26.01

Performance Monitoring - Read Samples

Endpoint​

/o/apm/samples

Overview​

Returns a page of the recorded samples of one metric of a network or device trace.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

Requires performance_monitoring Read permission.

Request Parameters​

ParameterTypeRequiredDescription
app_idStringYesApplication ID.
idStringYesTrace ID, as returned by Performance Monitoring - Read Overview.
typeStringYesTrace type: network or device.
metricStringYesMetric name, for example response_time or duration.
periodString or ArrayYesPeriod value: month, day, yesterday, hour, {number}days such as 30days, or a date range array.
queryJSON String (Object)NoFilter object applied to the data.
iDisplayStartNumberNoNumber of samples to skip. Defaults to 0.
iDisplayLengthNumberNoNumber of samples to return. Defaults to 10.
sEchoStringNoValue returned unchanged in the response.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

Examples​

Read the first 10 samples of a metric​

/o/apm/samples?
app_id=6991c75b024cb89cdc04efd2&
api_key=YOUR_API_KEY&
id=TRACE_ID&
type=network&
metric=response_time&
period=30days

Response​

Success Response​

{
"sEcho": "1",
"iTotalRecords": 16,
"iTotalDisplayRecords": 16,
"aaData": []
}

Response Fields​

FieldTypeDescription
sEchoStringValue of the sEcho request parameter.
iTotalRecordsNumberTotal number of samples.
iTotalDisplayRecordsNumberTotal number of samples.
aaDataArraySamples of the requested page.

Error Responses​

  • 400
{
"result": "Unacceptable trace type."
}
  • 400
{
"result": "Trace id not provided."
}
  • 400
{
"result": "Metric not provided."
}
  • 400
{
"result": "Missing request parameter: period"
}
  • 400
{
"result": "Bad request parameter: period"
}
  • 400
{
"result": "Samples data could not be fetched."
}