---
title: "Fetches (samples) current values for given metrics"
method: GET
path: "/pmapi/fetch"
tags: ["PMAPI HOST SERVICES"]
---

# Fetches (samples) current values for given metrics

`GET /pmapi/fetch`

If any of the names or pmids provided are valid, the response is a JSON document that provides the values for all instances of the metrics, unless a instance profile has been 
set for the web context (see section on InDom profiles below).
```
$ curl -s http://localhost:44322/pmapi/fetch?names=kernel.all.load,disk.all.read | pmjson
```
The response fields map directly to fields from the underlying [pmFetch](https://man7.org/linux/man-pages/man3/pmFetch.3.html)(3) sampling interface.

Numeric metric types are represented as JSON integer or floating-point values. Strings are passed verbatim, except that non-ASCII values are replaced with a Unicode 0xFFFD 
replacement character code.

In backward compatibility mode the timestamp is presented as a JSON map with second (sec) and microsecond (us) fields, instead of using the more compact floating point 
representation shown above.

**Reference:** [pmFetch](https://man7.org/linux/man-pages/man3/pmFetch.3.html)(3)

## Query parameters

- `delta` string
- `name` string
- `names` string
- `pmid` unknown
- `pmids` string
- `prefix` string
- `hostspec` string
- `context` number
- `polltimeout` number
- `client` string

## Response `200`

OK

## Changes

> 16 revisions in range; 1 could not be searched.

- **2020-10-21** `26cabf98ddfb` — 1 info
  - endpoint added
- **2020-10-20** `7da0633fad91` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/performancecopilot/apis/pmwebapi/changes/pmapi/fetch/get.md)

---

[API](https://skmtc.dev/performancecopilot/apis/pmwebapi.md) · [All operations](https://skmtc.dev/performancecopilot/apis/pmwebapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/performancecopilot/pmwebapi/revisions/666212c8ed6b/schema)
