# Update a Dapr subscription

`PUT /apis/dapr.diagrid.io/v1beta1/projects/{ProjectId}/subscriptions/{ProjectSubresourceId}`

Update an existing Dapr subscription by replacing its configuration.

## Request

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `ProjectId` | string | Yes | Unique identifier of the project. |
| `ProjectSubresourceId` | string | Yes | Unique identifier of the project subresource. |

### Request body

The Dapr subscription configuration to apply.

`application/json`

- `apiVersion` (string)
- `kind` (string)
- `metadata` (object)
  - `name` (string)
  - `uid` (string)
  - `resourceVersion` (integer)
  - `createdAt` (string)
  - `updatedAt` (string)
  - `deletedAt` (string)
  - `labels` (object<string, string>)
  - `annotations` (object)
- `spec` (object) — DaprSubscriptionSpec wraps the upstream Dapr SubscriptionSpec with Diagrid custom fields that are not part of the upstream Dapr API.
  - `pubsubname` (string) — The PubSub component name.
  - `topic` (string) — The topic name to subscribe to.
  - `metadata` (object<string, string>) — The optional metadata to provide the subscription.
  - `routes` (object) — Routes encapsulates the rules and optional default path for a topic.
    - `rules` (object[]) — The list of rules for this topic.
      - `match` (string) — The optional CEL expression used to match the event. If the match is not specified, then the route is considered the default. The rules are tested in the order specified, so they should be define from most-to-least specific. The default route should appear last in the list.
      - `path` (string) — The path for events that match this rule.
    - `default` (string) — The default path for this topic.
  - `deadLetterTopic` (string) — The optional dead letter queue for this topic to send events to.
  - `bulkSubscribe` (object) — BulkSubscribe encapsulates the bulk subscription configuration for a topic.
    - `enabled` (boolean)
    - `maxMessagesCount` (integer (int32))
    - `maxAwaitDurationMs` (integer (int32))
  - `dynamic` (boolean)
- `scopes` (string[])
- `status` (object)
  - `status` (string) — Status is the current processing status of the resource.
  - `updatedAt` (string) — UpdatedAt is the time of the last status update.
  - `messages` (object[]) — Messages contains any status messages, such as error details.
    - `message` (string)
  - `instances` (object[]) — Instances includes the status for each instance of the resource.
    - `cluster` (string) — Cluster is the name of the cluster hosting this instance.
    - `region` (string) — Region is the region where the instance is located (e.g. "us-east-1").
    - `placementId` (string) — PlacementID is the project placement this instance belongs to (e.g. "1").
    - `status` (string) — Status is the current processing status of the resource.
    - `updatedAt` (string) — UpdatedAt is the time of the last status update.
    - `messages` (object[]) — Messages contains any status messages, such as error details.
      - `message` (string)

Example:

```json
{
  "apiVersion": "dapr.io/v2alpha1",
  "kind": "Subscription",
  "metadata": {
    "name": "order-events"
  },
  "spec": {
    "pubsubname": "pubsub",
    "topic": "orders",
    "routes": {
      "default": "/orders"
    }
  },
  "scopes": [
    "order-api"
  ]
}
```

`application/vnd.api+json`

JSONAPI.org specification subscription response wrapper for UI.

- `data` (object) — Required.
  - `type` (string) — Type of the resource object.
  - `id` (string) — Unique identifier of the resource object.
  - `attributes` (object)
    - `apiVersion` (string)
    - `kind` (string)
    - `metadata` (object)
      - `name` (string)
      - `uid` (string)
      - `resourceVersion` (integer)
      - `createdAt` (string)
      - `updatedAt` (string)
      - `deletedAt` (string)
      - `labels` (object<string, string>)
      - `annotations` (object)
    - `spec` (object) — DaprSubscriptionSpec wraps the upstream Dapr SubscriptionSpec with Diagrid custom fields that are not part of the upstream Dapr API.
      - `pubsubname` (string) — The PubSub component name.
      - `topic` (string) — The topic name to subscribe to.
      - `metadata` (object<string, string>) — The optional metadata to provide the subscription.
      - `routes` (object) — Routes encapsulates the rules and optional default path for a topic.
        - `rules` (object[]) — The list of rules for this topic.
          - `match` (string) — The optional CEL expression used to match the event. If the match is not specified, then the route is considered the default. The rules are tested in the order specified, so they should be define from most-to-least specific. The default route should appear last in the list.
          - `path` (string) — The path for events that match this rule.
        - `default` (string) — The default path for this topic.
      - `deadLetterTopic` (string) — The optional dead letter queue for this topic to send events to.
      - `bulkSubscribe` (object) — BulkSubscribe encapsulates the bulk subscription configuration for a topic.
        - `enabled` (boolean)
        - `maxMessagesCount` (integer (int32))
        - `maxAwaitDurationMs` (integer (int32))
      - `dynamic` (boolean)
    - `scopes` (string[])
    - `status` (object)
      - `status` (string) — Status is the current processing status of the resource.
      - `updatedAt` (string) — UpdatedAt is the time of the last status update.
      - `messages` (object[]) — Messages contains any status messages, such as error details.
        - `message` (string)
      - `instances` (object[]) — Instances includes the status for each instance of the resource.
        - `cluster` (string) — Cluster is the name of the cluster hosting this instance.
        - `region` (string) — Region is the region where the instance is located (e.g. "us-east-1").
        - `placementId` (string) — PlacementID is the project placement this instance belongs to (e.g. "1").
        - `status` (string) — Status is the current processing status of the resource.
        - `updatedAt` (string) — UpdatedAt is the time of the last status update.
        - `messages` (object[]) — Messages contains any status messages, such as error details.
          - `message` (string)
  - `relationships` (object<string, object>) — Members of the relationships object represent references from the resource object in which it's defined to other resource objects.
    - Any of:
      - **option 1**
      - **option 2**
      - **option 3**
  - `links` (object<string, object>) — Link members related to the primary data.
    - One of:
      - **string (uri-reference)** — A string containing the link's URL.
      - **object**
        - `href` (string (uri-reference)) — Required. A string containing the link's URL.
        - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
  - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

## Responses

### 202 — Accepted for asynchronous processing.

### 403 — You are not authorized to perform this action.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

### 404 — The Dapr subscription was not found.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

### 409 — The request conflicts with the current state of the Dapr subscription.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

### default — Unexpected error.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
