Release soft reservation - Fabric

Release soft reservation

cURL

curl --request POST \
  --url https://api.fabric.inc/v3/inventory-networks/actions/soft-release \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-fabric-channel-id: <x-fabric-channel-id>' \
  --header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
  --data @- <<EOF
{
  "items": [
    {
      "channelId": "3",
      "lineItemId": "2",
      "quantity": 5,
      "sku": "OMSTESTSKU1",
      "backorderQuantity": 5,
      "errorMessage": "<string>",
      "itemId": "451008962041",
      "locationNumber": 999,
      "networkCode": "ShipToHome",
      "preorderQuantity": 5,
      "reservedNetworkCodes": [
        "<string>"
      ],
      "status": "<string>",
      "type": "['STANDARD','PREORDER','BACKORDER']"
    }
  ],
  "cartId": "b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569",
  "createdAt": "2022-08-01T18:03:28.483971941Z",
  "expiresAt": "2022-08-01T18:03:28.483971941Z",
  "id": "\"Infinity\"",
  "networkCode": "DCOnly",
  "orderId": "62ab7af89ed14510827fe074",
  "orderNumber": "order_20220729_883",
  "orderType": "['STANDARD','CSR']",
  "updatedAt": "2022-08-01T18:03:28.483971941Z",
  "vendorId": "test_vendor"
}
EOF

Python

import requests

url = "https://api.fabric.inc/v3/inventory-networks/actions/soft-release"

payload = {
    "items": [
        {
            "channelId": "3",
            "lineItemId": "2",
            "quantity": 5,
            "sku": "OMSTESTSKU1",
            "backorderQuantity": 5,
            "errorMessage": "<string>",
            "itemId": "451008962041",
            "locationNumber": 999,
            "networkCode": "ShipToHome",
            "preorderQuantity": 5,
            "reservedNetworkCodes": ["<string>"],
            "status": "<string>",
            "type": "['STANDARD','PREORDER','BACKORDER']"
        }
    ],
    "cartId": "b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569",
    "createdAt": "2022-08-01T18:03:28.483971941Z",
    "expiresAt": "2022-08-01T18:03:28.483971941Z",
    "id": "\"Infinity\"",
    "networkCode": "DCOnly",
    "orderId": "62ab7af89ed14510827fe074",
    "orderNumber": "order_20220729_883",
    "orderType": "['STANDARD','CSR']",
    "updatedAt": "2022-08-01T18:03:28.483971941Z",
    "vendorId": "test_vendor"
}
headers = {
    "x-fabric-tenant-id": "<x-fabric-tenant-id>",
    "x-fabric-channel-id": "<x-fabric-channel-id>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)

JavaScript (Fetch)

const options = {
  method: 'POST',
  headers: {
    'x-fabric-tenant-id': '<x-fabric-tenant-id>',
    'x-fabric-channel-id': '<x-fabric-channel-id>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    items: [
      {
        channelId: '3',
        lineItemId: '2',
        quantity: 5,
        sku: 'OMSTESTSKU1',
        backorderQuantity: 5,
        errorMessage: '<string>',
        itemId: '451008962041',
        locationNumber: 999,
        networkCode: 'ShipToHome',
        preorderQuantity: 5,
        reservedNetworkCodes: ['<string>'],
        status: '<string>',
        type: '[\'STANDARD\',\'PREORDER\',\'BACKORDER\']'
      }
    ],
    cartId: 'b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569',
    createdAt: '2022-08-01T18:03:28.483971941Z',
    expiresAt: '2022-08-01T18:03:28.483971941Z',
    id: '"Infinity"',
    networkCode: 'DCOnly',
    orderId: '62ab7af89ed14510827fe074',
    orderNumber: 'order_20220729_883',
    orderType: '[\'STANDARD\',\'CSR\']',
    updatedAt: '2022-08-01T18:03:28.483971941Z',
    vendorId: 'test_vendor'
  })
};

fetch('https://api.fabric.inc/v3/inventory-networks/actions/soft-release', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.fabric.inc/v3/inventory-networks/actions/soft-release",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'items' => [
        [
                'channelId' => '3',
                'lineItemId' => '2',
                'quantity' => 5,
                'sku' => 'OMSTESTSKU1',
                'backorderQuantity' => 5,
                'errorMessage' => '<string>',
                'itemId' => '451008962041',
                'locationNumber' => 999,
                'networkCode' => 'ShipToHome',
                'preorderQuantity' => 5,
                'reservedNetworkCodes' => [
                                '<string>'
                ],
                'status' => '<string>',
                'type' => '[\'STANDARD\',\'PREORDER\',\'BACKORDER\']'
        ]
    ],
    'cartId' => 'b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569',
    'createdAt' => '2022-08-01T18:03:28.483971941Z',
    'expiresAt' => '2022-08-01T18:03:28.483971941Z',
    'id' => '"Infinity"',
    'networkCode' => 'DCOnly',
    'orderId' => '62ab7af89ed14510827fe074',
    'orderNumber' => 'order_20220729_883',
    'orderType' => '[\'STANDARD\',\'CSR\']',
    'updatedAt' => '2022-08-01T18:03:28.483971941Z',
    'vendorId' => 'test_vendor'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
    "x-fabric-channel-id: <x-fabric-channel-id>",
    "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/inventory-networks/actions/soft-release"

payload := strings.NewReader("{\n  \"items\": [\n    {\n      \"channelId\": \"3\",\n      \"lineItemId\": \"2\",\n      \"quantity\": 5,\n      \"sku\": \"OMSTESTSKU1\",\n      \"backorderQuantity\": 5,\n      \"errorMessage\": \"<string>\",\n      \"itemId\": \"451008962041\",\n      \"locationNumber\": 999,\n      \"networkCode\": \"ShipToHome\",\n      \"preorderQuantity\": 5,\n      \"reservedNetworkCodes\": [\n        \"<string>\"\n      ],\n      \"status\": \"<string>\",\n      \"type\": \"['STANDARD','PREORDER','BACKORDER']\"\n    }\n  ],\n  \"cartId\": \"b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569\",\n  \"createdAt\": \"2022-08-01T18:03:28.483971941Z\",\n  \"expiresAt\": \"2022-08-01T18:03:28.483971941Z\",\n  \"id\": \"\\\"Infinity\\\"\