Update package tracking - Fabric

Update package tracking

cURL

curl --request POST \
  --url https://prod01.oms.fabric.inc/api/v2/shipment/tracking \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data '
{
  "event": "picked up",
  "eventId": "627963716b19511e8a3a631b",
  "timestamp": "2019-09-30T07:58:30.996Z",
  "shipmentCarrier": "FEDEX",
  "location": "Reno, NV",
  "notes": {}
}
'```

### Python

```python
import requests

url = "https://prod01.oms.fabric.inc/api/v2/shipment/tracking"

payload = {
    "event": "picked up",
    "eventId": "627963716b19511e8a3a631b",
    "timestamp": "2019-09-30T07:58:30.996Z",
    "shipmentCarrier": "FEDEX",
    "location": "Reno, NV",
    "notes": {}
}
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

const options = {
  method: 'POST',
  headers: {
    'x-site-context': '<x-site-context>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    event: 'picked up',
    eventId: '627963716b19511e8a3a631b',
    timestamp: '2019-09-30T07:58:30.996Z',
    shipmentCarrier: 'FEDEX',
    location: 'Reno, NV',
    notes: {}
  })
};

fetch('https://prod01.oms.fabric.inc/api/v2/shipment/tracking', 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://prod01.oms.fabric.inc/api/v2/shipment/tracking",
  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([
    'event' => 'picked up',
    'eventId' => '627963716b19511e8a3a631b',
    'timestamp' => '2019-09-30T07:58:30.996Z',
    'shipmentCarrier' => 'FEDEX',
    'location' => 'Reno, NV',
    'notes' => []
  ]),
  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;
}

Go

package main

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

func main() {

url := "https://prod01.oms.fabric.inc/api/v2/shipment/tracking"

payload := strings.NewReader("{\n  \"event\": \"picked up\",\n  \"eventId\": \"627963716b19511e8a3a631b\",\n  \"timestamp\": \"2019-09-30T07:58:30.996Z\",\n  \"shipmentCarrier\": \"FEDEX\",\n  \"location\": \"Reno, NV\",\n  \"notes\": {}\n}")

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

req.Header.Add("x-site-context", "<x-site-context>")
    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))
}

Java

HttpResponse<String> response = Unirest.post("https://prod01.oms.fabric.inc/api/v2/shipment/tracking")
  .header("x-site-context", "<x-site-context>")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"event\": \"picked up\",\n  \"eventId\": \"627963716b19511e8a3a631b\",\n  \"timestamp\": \"2019-09-30T07:58:30.996Z\",\n  \"shipmentCarrier\": \"FEDEX\",\n  \"location\": \"Reno, NV\",\n  \"notes\": {}\n}")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://prod01.oms.fabric.inc/api/v2/shipment/tracking")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-site-context"] = '<x-site-context>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"event\": \"picked up\",\n  \"eventId\": \"627963716b19511e8a3a631b\",\n  \"timestamp\": \"2019-09-30T07:58:30.996Z\",\n  \"shipmentCarrier\": \"FEDEX\",\n  \"location\": \"Reno, NV\",\n  \"notes\": {}\n}"

response = http.request(request)
puts response.read_body

Response examples

Success Response (200)

[
  {
    "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",
      "addressLine3": "<string>",
      "addressLine4": "<string>",
      "city": "New York",
      "state": "NY",
      "country": "USA",
      "postalCode": "1003",
      "type": "home",
      "latitude": 134.13413,
      "longitude": 757.0435
    },
    "recipient": [
      {
        "name": {
          "first": "John",
          "middle": "<string>",
          "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",
        "estimatedDeliveryDate": "2022-05-26T07:58:30.996Z",
        "shipmentMethod": "ground",
        "shipmentCarrier": "FEDEX",
        "weight": "500 gram",
        "trackingNumber": "1Z999AA10123456784",
        "trackingURL": "https://fedex.com/tracking",
        "trackingDetails": [
          {
            "event": "picked up",
            "eventId": "627963716b19511e8a3a631b",
            "timestamp": "2019-09-30T07:58:30.996Z",
            "shipmentCarrier": "FEDEX",
            "location": "Reno, NV",
            "notes": {}
          }
        ],
        "items": [
          {
            "shipmentLineItemId": "607f1f77bcf86cd799439011",
            "orderId": "317736896",
            "orderNumber": "507f1f77bcf86cd799439011",
            "lineItemId": "1",
            "itemId": "100023",
            "sku": "SKU0023",
            "channelId": "12",
            "segment": null,
            "vendorId": "56",
            "orderedQuantity": 2,
            "shippedQuantity": 2,
            "returnQuantity": 1,
            "returnAmount": 10,
            "fees": [
              {
                "type": "tax",
                "value": 34.56,
                "quantity": 12,
                "refundAmount": 10.4
              }
            ],
            "giftCard": [
              {
                "giftCardNum": "453456765",
                "amount": 50,
                "giftCardStatus": "ACTIVE",
                "giftCardActiveRequestDate": "2022-05-26T07:58:30.996Z",
                "giftCardActiveDate": "2022-06-26T07:58:30.996Z"
              }
            ],
            "attributes": {},
            "uom": null
          }
        ]
      }
    ],
    "scratchedItems": [
      {
        "orderId": "507f1f77bcf86cd799439012",
        "lineItemId": "2",
        "itemId": "100043",
        "sku": "SKU00043",
        "quantity": 1,
        "reasonCode": "<string>",
        "subReasonCode": "<string>",
        "attributes": {},
        "uom": null
      }
    ],
    "createdAt": "2022-06-06T07:58:30.996Z",
    "updatedAt": "2022-06-06T07:58:30.996Z",
    "auditLogs": [
      {
        "auditType": "create",
        "employeeId": "62272e917b12209e68751d94",
        "auditTimestamp": "2022-05-12T09:24:54.804Z",
        "source": "POS",
        "note": "Note",
        "attributes": {},
        "updatedFields": [
          {
            "attributeName": "UOM",
            "attributeOriginalValue": "PK"
          }
        ]
      }
    ],
    "attributes": {}
  }
]```

#### Error Responses

```json
{
  "message": "Bad Request"
}
{
  "message": "Object Not Found."
}
{
  "message": "Internal Server Error"
}

Authorization

Headers

Body