---
title: "Create a resource"
method: POST
path: "/api/v1/devices/{deviceId}/resource-links/{resourceHref}"
tags: ["Resource Links"]
---

# Create a resource

`POST /api/v1/devices/{deviceId}/resource-links/{resourceHref}`

This API enables you to create a new resource on a collection supporting create operation - interface `oic.if.create` shall be present. The resource is automatically published by the device, about what you are informed through an `RESOURCE_PUBLISHED` event.

## Query parameters

- `timeToLive` integer

## Request body

- ResourceCreateContent
  - `rt` string[], required
  - `if` string[], required
  - `rep` object, required — Resource content provided as JSON object or base64 encoded CBOR.
  - `p` object, required
    - `bm` integer, required

## Response `200`

Resource create response containing href to a new resource.

- 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

- `400` — Bad Request
- `401` — Not authorized
- `403` — Forbidden
- `404` — Entity was not found.

---

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