Activate gift card - Fabric

Activate gift card

cURL

curl --request POST \
  --url https://prod01.oms.fabric.inc/api/v2/shipment/gift-card/activation \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data '
{
  "shipmentId": "78974156816152",
  "items": [
    {
      "itemId": "100023",
      "sku": "SKU0023",
      "channelId": "12",
      "orderId": "<string>",
      "orderNumber": "507f1f77bcf86cd799439011",
      "lineItemId": "1",
      "giftCard": [
        {
          "giftCardNum": "453456765",
          "giftCardStatus": "ACTIVE"
        }
      ]
    }
  ]
}
'

Python

import requests

url = "https://prod01.oms.fabric.inc/api/v2/shipment/gift-card/activation"

payload = {
    "shipmentId": "78974156816152",
    "items": [
        {
            "itemId": "100023",
            "sku": "SKU0023",
            "channelId": "12",
            "orderId": "<string>",
            "orderNumber": "507f1f77bcf86cd799439011",
            "lineItemId": "1",
            "giftCard": [
                {
                    "giftCardNum": "453456765",
                    "giftCardStatus": "ACTIVE"
                }
            ]
        }
    ]
}
headers = {
    "x-site-context": "<x-site-context>",
    "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-site-context': '<x-site-context>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    shipmentId: '78974156816152',
    items: [
      {
        itemId: '100023',
        sku: 'SKU0023',
        channelId: '12',
        orderId: '<string>',
        orderNumber: '507f1f77bcf86cd799439011',
        lineItemId: '1',
        giftCard: [{giftCardNum: '453456765', giftCardStatus: 'ACTIVE'}]
      }
    ]
  })
};

fetch('https://prod01.oms.fabric.inc/api/v2/shipment/gift-card/activation', 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://prod01.oms.fabric.inc/api/v2/shipment/gift-card/activation",
  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([
    'shipmentId' => '78974156816152',
    'items' => [
        [
                'itemId' => '100023',
                'sku' => 'SKU0023',
                'channelId' => '12',
                'orderId' => '<string>',
                'orderNumber' => '507f1f77bcf86cd799439011',
                'lineItemId' => '1',
                'giftCard' => [
                                [
                                                                'giftCardNum' => '453456765',
                                                                'giftCardStatus' => 'ACTIVE'
                                ]
                ]
        ]
    ]
  ]),
  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 Structure

{
  "shipmentId": "627963716b19511e8a3a631b",
  "shipmentNum": "78974156816152",
  "invoiceId": "5674156816152",
  "allocationId": "112345678912340",
  "orderNumber": ["112345678912340","112345678912340"],
  "poNumber": "1125",
  "vendorId": "56",
  "statusCode": "SHIPPED",
  "type": "STANDARD",
  "reshipmentReasonCode": "Order went missing",
  "shipDate": "2022-06-06T07:58:30.996Z",
  "locationNum": "132412",
  "locationType": "DC",
  "totalCartons": 2,
  "masterTrackingNumber": "TX112345678",
  "shipToId": "1",
  "shipToAddress": {
    "addressLine1": "888 Broadway",
    "addressLine2": "505 suite",
    "city": "New York",
    "state": "NY",
    "country": "USA",
    "postalCode": "1003"
  },
  "recipient": [{
    "name": {
      "first": "John",
      "last": "Doe"
    },
    "email": "support@abc.inc",
    "phone": {"number": 10612345678,"type": "MOBILE"}
  }],
  "cartons": [{
    "cartonNum": "1",
    "cartonType": "Package",
    "promisedDeliveryDate": "2022-05-26T07:58:30.996Z",
    "estimatedShipDate": "2022-05-25T07:58:30.996Z",
    "weight": "500 gram",
    "trackingNumber": "1Z999AA10123456784",
    "trackingURL": "https://fedex.com/tracking"
  }],
  "createdAt": "2022-06-06T07:58:30.996Z",
  "updatedAt": "2022-06-06T07:58:30.996Z"
}