## Update a specific price guard

### cURL

```bash
curl --request PUT \
  --url https://live.copilot.fabric.inc/api-offers/price-guard/{priceGuardId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data '
{
  "itemId": 10000000123,
  "priceListId": 100000,
  "itemSku": "DEF-SKU-1",
  "MSRP": 299,
  "MAP": 299,
  "ceiling": 299,
  "floor": 299
}
'```

### Python

```python
import requests

url = "https://live.copilot.fabric.inc/api-offers/price-guard/{priceGuardId}"

payload = {
    "itemId": 10000000123,
    "priceListId": 100000,
    "itemSku": "DEF-SKU-1",
    "MSRP": 299,
    "MAP": 299,
    "ceiling": 299,
    "floor": 299
}
headers = {
    "x-site-context": "<x-site-context>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

### JavaScript

```javascript
const options = {
  method: 'PUT',
  headers: {
    'x-site-context': '<x-site-context>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    itemId: 10000000123,
    priceListId: 100000,
    itemSku: 'DEF-SKU-1',
    MSRP: 299,
    MAP: 299,
    ceiling: 299,
    floor: 299
  })
};

fetch('https://live.copilot.fabric.inc/api-offers/price-guard/{priceGuardId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://live.copilot.fabric.inc/api-offers/price-guard/{priceGuardId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'itemId' => 10000000123,
    'priceListId' => 100000,
    'itemSku' => 'DEF-SKU-1',
    'MSRP' => 299,
    'MAP' => 299,
    'ceiling' => 299,
    'floor' => 299
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
    "x-site-context: <x-site-context>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>
```

### Response

#### Successful Response

```json
{
  "_id": "614b58924e92f6861ac9d43b",
  "itemId": 10000000123,
  "itemSku": "DEF-SKU-1",
  "priceListId": 100000,
  "MSRP": 299,
  "MAP": 299,
  "ceiling": 299,
  "floor": 299,
  "deleted": false,
  "createdAt": "2020-12-14T12:15:43.646Z",
  "updatedAt": "2021-12-14T12:15:43.646Z"
}
```

#### Error Responses

```json
{
  "code": "REQUEST_VALIDATION",
  "message": "MSRP must be greater than 0"
}
```

```json
{
  "code": "PRICE_GUARD_NOT_FOUND",
  "message": "No Price Guard record with this Id Found."
}
```

```json
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error."
}
```
