Get the order draft by the order draft ID - Fabric

Get the order draft by the order draft ID

cURL

curl --request GET \
  --url https://api.fabric.inc/v3/order-drafts/{orderDraftId} \
  --header 'Authorization: Bearer <token>' \
  --header 'x-fabric-tenant-id: <x-fabric-tenant-id>'

Example Code Snippets

Python

import requests

url = "https://api.fabric.inc/v3/order-drafts/{orderDraftId}"

headers = {
    "x-fabric-tenant-id": "<x-fabric-tenant-id>",
    "Authorization": "Bearer <token>"
}

response = requests.get(url, headers=headers)

print(response.text)

JavaScript (Fetch)

const options = {
  method: 'GET',
  headers: {'x-fabric-tenant-id': '<x-fabric-tenant-id>', Authorization: 'Bearer <token>'}
};

fetch('https://api.fabric.inc/v3/order-drafts/{orderDraftId}', 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/order-drafts/{orderDraftId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "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;
}
?>

Example Response Structure

{
  "cartId": "c86f777b-1885-4ddf-961d-542ba80a69b8",
  "order": {
    "id": "6d65755f-b1d9-4c9d-bb5b-118d317f8db4",
    "number": "100001",
    "lineItems": [
      {
        "id": "6d65755f-b1d9-4c9d-bb5b-118d317f8db4",
        "supplementaryData": {
          "productTitle": "Lamp"
        }
      }
    ],
    "attributes": {
      "orderStatus": "ACTIVE"
    }
  },
  "attributes": {
    "name": "wishlist"
  },
  "configuration": {
    "order": {
      "validate": {}
    },
    "product": {
      "cacheExpiry": 7776000,
      "behaviors": {
        "add": "REJECT",
        "update": "WARN",
        "get": "WARN",
        "cacheExpiry": "WARN"
      },
      "maxQuantity": {
        "limit": 100,
        "behaviors": {
          "add": "REJECT",
          "update": "WARN",
          "get": "WARN"
        }
      }
    },
    "inventory": {
      "cacheExpiry": 7776000,
      "behaviors": {
        "add": "REJECT",
        "update": "WARN",
        "get": "WARN",
        "cacheExpiry": "WARN"
      },
      "check": "SKU"
    },
    "tax": {
      "cacheExpiry": 7776000,
      "behaviors": {
        "cacheExpiry": "WARN"
      }
    },
    "promotions": {
      "cacheExpiry": 7776000,
      "behaviors": {
        "cacheExpiry": "WARN"
      }
    }
  },
  "customerContext": {
    "id": "109840938",
    "segments": [
      {
        "name": "membership",
        "value": [
          "gold",
          "silver"
        ]
      }
    ],
    "attributes": {
      "email": "test@gmail.com"
    },
    "sessionId": "3a5fd2d3-5c96-4e57-b069-7ff2a88c1119"
  },
  "status": "ACTIVE",
  "price": {
    "total": 800,
    "subtotal": 750,
    "tax": 20,
    "fulfillments": 25,
    "discounts": 10,
    "fees": 5,
    "adjustments": 10
  }
}