## Update a specific location

### cURL

```
curl --request PUT \
  --url https://api.fabric.inc/v3/locations/{locationNumber} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
  --data '
"{\"name\":\"Store 403\",\"number\":403}"'
```

### Python

```
import requests

url = "https://api.fabric.inc/v3/locations/{locationNumber}"

payload = "{\"name\":\"Store 403\",\"number\":403}" 
headers = {
    "x-fabric-tenant-id": "<x-fabric-tenant-id>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
```

### JavaScript (Fetch)

```
const options = {
  method: 'PUT',
  headers: {
    'x-fabric-tenant-id': '<x-fabric-tenant-id>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify('{"name":"Store 403","number":403}')
};

fetch('https://api.fabric.inc/v3/locations/{locationNumber}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP

```
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.fabric.inc/v3/locations/{locationNumber}",
  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('{"name":"Store 403","number":403}'),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
    "x-fabric-tenant-id: <x-fabric-tenant-id>"
  ],
]);

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

curl_close($curl);

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

### Go

```
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

url := "https://api.fabric.inc/v3/locations/{locationNumber}"

payload := strings.NewReader("{\"name\":\"Store 403\",\"number\":403}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("x-fabric-tenant-id", "<x-fabric-tenant-id>")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

### Error Response Structures

#### 200

```json
{
  "locationNumber": 23,
  "name": "Seattle Store",
  "locationId": "9372919a8219e8",
  "isActive": true,
  "address": {
    "region": "WA",
    "addressLine1": 123,
    "addressLine2": "Suite 100",
    "addressLine3": "Seventh floor",
    "addressLine4": "Attention: Pat E. Kake",
    "city": "Seattle",
    "countryCode": "US",
    "postalCode": 98121,
    "type": "Home",
    "contacts": [
      {
        "type": "OFFICE",
        "email": "abc@mail.com",
        "phone": [
          {
            "number": "0281923712",
            "type": "MOBILE"
          }
        ],
        "name": {
          "firstName": "Pat",
          "middleName": "E",
          "lastName": "Kake"
        }
      }
    ]
  },
  "type": "DC",
  "capacity": {
    "maxAllocations": 30,
    "currentAllocations": 5,
    "infiniteAllocation": true,
    "allocationPercentage": 20,
    "isCapacityFull": true
  },
  "services": {
    "brand": "WHBM",
    "channel": "Frontline"
  },
  "createdAt": "2022-05-25T07:58:30.996Z",
  "updatedAt": "2022-05-25T07:58:30.996Z"
}
```

#### 400

```json
{
  "type": "CLIENT_ERROR",
  "errorCode": "SERVICE-4003",
  "message": "Mandatory param(s): `requiredField1` is/are missing",
  "errors": []
}
```

#### 401

```json
{
  "type": "CLIENT_ERROR",
  "errorCode": "SERVICE-4001",
  "message": "Unauthorized request",
  "errors": []
}
```

#### 404

```json
{
  "message": "Location with locationNumber 20 not found"
}
```

#### 500

```json
{
  "type": "SERVER_ERROR",
  "errorCode": "SERVICE-5000",
  "message": "Internal server error",
  "errors": []
}
```

### Authorization

- **Authorization**: `Bearer <token>` (required)
- **x-fabric-tenant-id**: `string` (required)

### Path Parameters

- **locationNumber**: `string` (required) - Merchant-specified unique number to identify the location.

### Body

- **isActive**: `boolean` - Indicates whether the location is active for order fulfillment operations.
- **address**: `object` - The updated physical address of the location.
- **type**: `string` - The classification of the location.
- **capacity**: `object` - Defines the maximum allocation and throughput limits for the location.
- **services**: `object` - Custom key-value attributes that define the location’s services.
- **operatingHours**: `object[]` - Daily schedule of the location.
- **coordinates**: `object` - The geographic coordinates of the location.
- **attributes**: `object` - Additional custom attributes associated with the location.
- **supportedCarriers**: `object[]` - A list of shipping carriers supported by the location.
- **activeFulfillmentMethods**: `object` - A map of fulfillment methods that are currently active for the location.
- **transfer**: `object` - Configuration for inventory transfer operations involving this location.

### Response

- **200**: A successful update will return the location details, including configuration, operational status, capacity, and service attributes.
