Update a specific location - Fabric

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

{
  "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

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

401

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

404

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

500

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

Authorization

Path Parameters

Body

Response