Create shipping method - Fabric

Create shipping method

cURL

curl --request POST \
  --url https://api.fabric.inc/v3/shipping-methods \
  --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 '
{
  "code": "SDD",
  "name": "Express Delivery",
  "addressType": "APO",
  "attributes": {
    "carrier": "FedEx",
    "type": "Next Day"
  },
  "carrier": "FedEx",
  "cartValue": {
    "max": 3.1,
    "min": 2.1
  },
  "cost": 20.5,
  "createdBy": "User1",
  "currency": "USD",
  "cutoffTime": 1330,
  "description": "Express Delivery 2 - 5 days",
  "dimension": {
    "max": {
      "height": 2.4,
      "length": 4.6,
      "uom": "EA",
      "width": 3.5
    },
    "min": {
      "height": 2.4,
      "length": 4.6,
      "uom": "EA",
      "width": 3.5
    }
  },
  "maximumDays": 5,
  "minimumDays": 2,
  "region": "CA",
  "taxCode": "FR01",
  "weight": {
    "max": 3.1,
    "min": 2.1
  }
}
'

Payload Example in Python

import requests

url = "https://api.fabric.inc/v3/shipping-methods"

payload = {
    "code": "SDD",
    "name": "Express Delivery",
    "addressType": "APO",
    "attributes": {
        "carrier": "FedEx",
        "type": "Next Day"
    },
    "carrier": "FedEx",
    "cartValue": {
        "max": 3.1,
        "min": 2.1
    },
    "cost": 20.5,
    "createdBy": "User1",
    "currency": "USD",
    "cutoffTime": 1330,
    "description": "Express Delivery 2 - 5 days",
    "dimension": {
        "max": {
            "height": 2.4,
            "length": 4.6,
            "uom": "EA",
            "width": 3.5
        },
        "min": {
            "height": 2.4,
            "length": 4.6,
            "uom": "EA",
            "width": 3.5
        }
    },
    "maximumDays": 5,
    "minimumDays": 2,
    "region": "CA",
    "taxCode": "FR01",
    "weight": {
        "max": 3.1,
        "min": 2.1
    }
}
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)

Response Example

{
  "code": "SDD",
  "name": "Express Delivery",
  "addressType": "APO",
  "attributes": {
    "carrier": "FedEx",
    "type": "Next Day"
  },
  "carrier": "FedEx",
  "cartValue": {
    "max": 3.1,
    "min": 2.1
  },
  "cost": 20.5,
  "createdBy": "User1",
  "currency": "USD",
  "cutoffTime": 1330,
  "description": "Express Delivery 2 - 5 days",
  "dimension": {
    "max": {
      "height": 2.4,
      "length": 4.6,
      "uom": "EA",
      "width": 3.5
    },
    "min": {
      "height": 2.4,
      "length": 4.6,
      "uom": "EA",
      "width": 3.5
    }
  },
  "maximumDays": 5,
  "minimumDays": 2,
  "region": "CA",
  "taxCode": "FR01",
  "weight": {
    "max": 3.1,
    "min": 2.1
  }
}

Error Responses

{
  "errors": [{
    "message": "Invalid request",
    "type": "CLIENT_ERROR"
  }],
  "message": "Bad request",
  "type": "CLIENT_ERROR"
}
{
  "message": "Unauthorized request",
  "type": "CLIENT_ERROR"
}
{
  "message": "Internal server error",
  "type": "SERVER_ERROR"
}