For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create a data source shipping option

Binds a shipping option to a data source, giving that pairing its own calculator and rule.

The pairing of shipping_option and data_source must be unique. If the shipping option is already bound to that data source, the request returns 400 with the message "The fields shipping_option, data_source must make a unique set." under the non_field_errors key. Update the existing binding instead of creating a second one.

To make the binding eligible for all baskets, send rule as an empty object ({}) and the "any basket" rule is stored for you. rule is a required field, so include the key even when the object is empty.

shipping_option, data_source, is_active, calculator and rule are required; sort_order and description are optional.

The response echoes the created record with shipping_option and data_source expanded into objects.

post
/data_source_shipping_options/
Authorizations
AuthorizationstringRequired

Token credential sent in the Authorization header, in the form: Token <your-token>. Requires a staff (admin) account.

Body

Fields for creating a data source shipping option.

The shipping option and the data source are referenced by their identifiers here, and both are expanded into objects in the response.

shipping_optionintegerRequired

Identifier of the shipping option to bind. Must reference an existing shipping option.

data_sourceintegerRequired

Identifier of the data source to bind. Must reference an existing data source.

is_activebooleanRequired

Whether this binding is active. Only active bindings are evaluated at checkout. Required on create.

calculatorobjectRequired

Calculator configuration for this binding. The object must contain a slug key identifying the calculator. See the Shipping Rules & Calculators guide for available calculators and their parameters.

Example: {"slug":"fixed-price-calculator","fixed_price":"14.99"}
ruleobjectRequired

Rule configuration for this binding. The object contains a slug key identifying the rule. Send {} to make every basket eligible and the "any basket" rule is stored for you; the rule key is required, so include it even when the object is empty. See the Shipping Rules & Calculators guide for available rules and their parameters.

sort_orderintegerOptional

Order in which this binding is evaluated at checkout. Lower values are evaluated first.

Default: 0
descriptionstring · nullableOptional

Optional description of this binding.

Responses
201

The created data source shipping option.

application/json

A data source shipping option returned by the API — one shipping option bound to one data source, with its own calculator and rule.

pkintegerRead-onlyRequired

Unique identifier of the data source shipping option.

is_activebooleanRequired

Whether this binding is active. Only active bindings are evaluated at checkout.

Default: true
calculatorobjectRequired

Calculator configuration for this binding. Determines how the shipping cost is computed for this seller.

The object contains at minimum a slug key identifying the calculator. See the Shipping Rules & Calculators guide for available calculators and their parameters.

Example: {"slug":"amount-based-calculator","upper_limit":"150.00","fixed_price":"14.99","discount_price":"0.00"}
ruleobjectRequired

Rule configuration for this binding. Determines which baskets are eligible for this seller's delivery method.

The object contains a slug key identifying the rule. See the Shipping Rules & Calculators guide for available rules and their parameters.

Example: {"slug":"any-rule","name":"Any Rule"}
sort_orderintegerRequired

Order in which this binding is evaluated at checkout. Lower values are evaluated first.

Default: 0
descriptionstring · nullableRequired

Optional description of this binding.

post/data_source_shipping_options/
POST /api/v1/remote/1/data_source_shipping_options/ HTTP/1.1
Host: sandbox.akinon.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 197

{
  "shipping_option": 4,
  "data_source": 2,
  "is_active": true,
  "calculator": {
    "slug": "fixed-price-calculator",
    "fixed_price": "14.99"
  },
  "rule": {},
  "sort_order": 0,
  "description": "Flat rate for the main warehouse"
}
{
  "pk": 12,
  "is_active": true,
  "calculator": {
    "slug": "fixed-price-calculator",
    "fixed_price": "14.99"
  },
  "rule": {
    "slug": "any-rule",
    "name": "Any Rule"
  },
  "sort_order": 0,
  "shipping_option": {
    "pk": 4,
    "name": "Standard Shipping",
    "slug": "standard-shipping",
    "is_active": true,
    "sort_order": 0,
    "description": null,
    "kwargs": {
      "required_fields": []
    },
    "delivery_type": {
      "value": "standard",
      "label": "Standard Delivery"
    }
  },
  "data_source": {
    "pk": 2,
    "name": "Main Warehouse",
    "title": "Main Warehouse",
    "slug": "main-warehouse",
    "is_active": true
  },
  "description": "Flat rate for the main warehouse"
}

Last updated

Was this helpful?