---
title: "Retrieve a resource"
method: GET
path: "/api/v1/devices/{deviceId}/resources/{resourceHref}"
tags: ["Resources"]
---

# Retrieve a resource

`GET /api/v1/devices/{deviceId}/resources/{resourceHref}`

The plgd hub builds an up to date [Twin](https%3A%2F%2Fplgd.dev%2Ffeatures%2Fdevice-shadow%2F) for each published resource.
Retrieving it's content using this API returnes an eventually consistent shadow content of the resource.
There is a possibility to bypass the shadow by setting the query parameter `shadow` to `false` or by setting the interface query parameter, which allows you to set the command expiration.
If etag is provided, the response will be 304 Not Modified if the resource has not changed otherwise the resource will be returned.

## Query parameters

- `interface` string
- `shadow` boolean
- `timeToLive` integer
- `onlyContent` boolean

## Headers

- `ETag` string, base64

## Response `200`

Resource content.

- object
  - `data` Resource
    - `resourceId` ResourceId
      - `deviceId` string, uuid
      - `href` string, url
    - `content` union
      - ResourceContent
      - ResourceCreatedContent
        - `href` string, uri
        - `rt` string[]
        - `if` string[]
        - `rep` object — Resource content provided as JSON object or base64 encoded CBOR.
    - `auditContext` AuditContext
      - `userId` string
      - `correlationId` string
    - `eventMetadata` EventMetadata
      - `version` string, uint64
      - `timestamp` string, int64
      - `connectionId` string
      - `sequence` string, uint64
    - `status` 'UNKNOWN' | 'OK' | 'BAD_REQUEST' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'NOT_FOUND' | 'UNAVAILABLE' | 'NOT_IMPLEMENTED' | 'ACCEPTED' | 'ERROR' | 'METHOD_NOT_ALLOWED' | 'CREATED' | 'NOT_MODIFIED'

## Other responses

- `304` — Resource content not modified.
- `400` — Bad Request
- `401` — Not authorized
- `404` — Entity was not found.

## Changes

> 42 revisions in range; 3 not diffed.

- **2024-05-15** `bb6060e9c93c` — 1 info
  - added the new optional `query` request parameter `onlyContent`
- **2023-10-03** `43d5d4e000ad` — 1 warning, 2 info
  - added the new `NOT_MODIFIED` enum value to the `data/status` response property for the response status `200`
  - added the new optional `header` request parameter `ETag`
  - added the non-success response with the status `304`
- **2022-01-05** `afc9b9af73b5` — 4 info
  - added the optional property `error/details/items/typeUrl` to the response with the `400` status
  - added the optional property `error/details/items/typeUrl` to the response with the `401` status
  - added the optional property `error/details/items/value` to the response with the `400` status
  - added the optional property `error/details/items/value` to the response with the `401` status
- **2021-08-05** `750a4952762c` — 1 info
  - added the new optional `query` request parameter `timeToLive`
- **2021-07-27** `4d121732b593` — 1 info
  - endpoint added

[Full history](https://skmtc.dev/plgd-dev/apis/plgd-http-gateway/changes/api/v1/devices/:deviceId/resources/:resourceHref/get.md)

---

[API](https://skmtc.dev/plgd-dev/apis/plgd-http-gateway.md) · [All operations](https://skmtc.dev/plgd-dev/apis/plgd-http-gateway/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/plgd-dev/plgd-http-gateway/revisions/bbfd9fa43407/schema)
