# @put

Sends the value of a publisher as the body of a `PUT` request, to replace a resource, and stores the response in an `ApiResult<T>` property. It takes the same arguments, options and `send(component)` handle as [@post](/docs/decorators/post); only the HTTP method differs.

## Import

<sonic-code language="typescript">
  <template>
import { put, type ApiResult } from "@supersoniks/concorde/decorators";
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
  </template>
</sonic-code>

## Basic usage

The full passenger record is sent on connect and after each body mutation. Placeholders such as `${passengerId}` are resolved on the host component.

<sonic-code language="typescript">
  <template>
type Passenger = { name: string; flight: string; seat: string };

const passengerKey = new DataProviderKey&lt;Passenger&gt;("passengerForm");
const savePassenger = put(
  new Endpoint&lt;Passenger, { passengerId: string }&gt;("passengers/${passengerId}"),
  passengerKey,
  { autoPostOnBodyMutation: false },
);

@property() passengerId = "ada-lindqvist";

@savePassenger
@state()
payload?: ApiResult&lt;Passenger&gt;;

async save() {
  await savePassenger.send(this);
}
  </template>
</sonic-code>

Triggers, the `send` method decorator and every option are described on [@post](/docs/decorators/post).

## API reference

| Argument | Type | Description |
|----------|------|-------------|
| `endpoint` | `Endpoint<T>` | Resource path and response type |
| `bodyKey` | `DataProviderKey<B>` | Publisher read as the full replacement body |
| `configurationKey` | `DataProviderKey<APIConfiguration>` (optional) | API configuration publisher. Default: HTML scope |
| `options` | `PutOptions` | Same as [@post options](/docs/decorators/post) |
