Order Lines

Working with order lines.

Create Order Line

POST /v1/orders/goodsouts/:id/lines

Adds a new line to an existing goodsout.

Parameter Regular Expressions

  • :id: [1-9][0-9]{0,}

Request Body

CreateOrderGoodsoutLine

Return Type

OrderGoodsoutLines

Types for the Request Body

CreateOrderGoodsoutLine (root level)

KeyDescriptionTypesRestrictions
variationProduct descriptionVariationrequired
not null
net_unit_principalThe net amount paid for a single one of these items.numberrequired
not null
min is 0
principal_taxThe ID of the tax that should be applied to the line principal value.integerrequired
not null
min is 1
discountThe amount of discount to be applied to the line principal value.numbernot null
min is 0
discount_typeThe type of discount to apply.enum(percentage, value)not null
quantityThe quantity ordered.integerrequired
not null
min is 1

Variation

KeyDescriptionTypesRestrictions
skuThe product’s stock keeping unit (SKU).stringrequired
not null
min length is 1
channelThe product channel’s ID.integerrequired
not null
min is 1

Rate limit cost

Each call to this endpoint deducts 2 credits from your request bucket.

Scopes

This endpoint is only available for users with scope APP::ORDERS::MANAGE.

<?php

// Instantiate a GuzzleHttp client
$client = new \GuzzleHttp\Client();

// Make the request
$response = $client->request("POST", "https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines", [
    "body" => json_encode([
        "variation" => [
            "sku" => "GREEN-BALL",
            "channel" => 1,
        ],
        "net_unit_principal" => 12.55,
        "principal_tax" => 12,
        "discount" => 0,
        "discount_type" => "value",
        "quantity" => 4,
    ]),
    "headers" => [
        "Content-Type" => "application/json",
        "Access-Token" => "my-token-from-login",
    ],
]);

// Process the response
$responseBody = json_decode($response->getBody(), true);
require 'rest-client'
require 'json'

# Make the request
response = RestClient.post 'https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines', {
  variation: {
    sku: "GREEN-BALL",
    channel: 1,
  },
  net_unit_principal: 12.55,
  principal_tax: 12,
  discount: 0,
  discount_type: "value",
  quantity: 4,
}, {
  access_token: 'my-token-from-login',
  content_type: :json,
  accept: :json
}

# Process the response
puts response.body
// Require the node HTTP module
var request = require("request");

// Make the request
request({
    method: "POST",
    json: true,
    uri: "https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines",
    body: {
        "variation": {
            "sku": "GREEN-BALL",
            "channel": 1
        },
        "net_unit_principal": 12.55,
        "principal_tax": 12,
        "discount": 0,
        "discount_type": "value",
        "quantity": 4
    },
    headers: {
        "Access-Token": "my-token-from-login",
        "Content-Type": "application/json",
    },
    (error, response, body) => {
        // Process the response
        console.log(body);
    },
});
# Make the request
curl --location --request POST 'https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines' \
--header 'Content-Type: application/json' \
--header 'Access-Token: my-token-from-login' \
--data-raw '{
    "variation": {
        "sku": "GREEN-BALL",
        "channel": 1
    },
    "net_unit_principal": 12.55,
    "principal_tax": 12,
    "discount": 0,
    "discount_type": "value",
    "quantity": 4
}'

Example result:

{
    "meta": {
        "request_reference": "235chjz9h-c893v86"
    },
    "data": {
        "id": 3450345,
        "transaction_sku": "GREEN-BALL",
        "quantity": 4,
        "discount_type": "percentage",
        "discount": 1.5,
        "net_unit_principal": 12,
        "status": "active"
    }
}

Update Order Line Quantity

PUT /v1/orders/goodsouts/:id/lines/:lineId/quantity

Updates the quantity of an order goodsout line.

Parameter Regular Expressions

  • :id: [1-9][0-9]{0,}
  • :lineId: [1-9][0-9]{0,}

Request Body

UpdateGoodsoutLineQuantity

Return Type

OrderGoodsoutLines

Types for the Request Body

UpdateGoodsoutLineQuantity (root level)

KeyDescriptionTypesRestrictions
quantityQuantity.integerrequired
not null
min is 1

Rate limit cost

Each call to this endpoint deducts 2 credits from your request bucket.

Scopes

This endpoint is only available for users with scope APP::ORDERS::MANAGE.

<?php

// Instantiate a GuzzleHttp client
$client = new \GuzzleHttp\Client();

// Make the request
$response = $client->request("PUT", "https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines/3450345/quantity", [
    "body" => json_encode([
        "quantity" => 4,
    ]),
    "headers" => [
        "Content-Type" => "application/json",
        "Access-Token" => "my-token-from-login",
    ],
]);

// Process the response
$responseBody = json_decode($response->getBody(), true);
require 'rest-client'
require 'json'

# Make the request
response = RestClient.put 'https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines/3450345/quantity', {
  quantity: 4,
}, {
  access_token: 'my-token-from-login',
  content_type: :json,
  accept: :json
}

# Process the response
puts response.body
// Require the node HTTP module
var request = require("request");

// Make the request
request({
    method: "PUT",
    json: true,
    uri: "https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines/3450345/quantity",
    body: {
        "quantity": 4
    },
    headers: {
        "Access-Token": "my-token-from-login",
        "Content-Type": "application/json",
    },
    (error, response, body) => {
        // Process the response
        console.log(body);
    },
});
# Make the request
curl --location --request PUT 'https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines/3450345/quantity' \
--header 'Content-Type: application/json' \
--header 'Access-Token: my-token-from-login' \
--data-raw '{
    "quantity": 4
}'

Example result:

{
    "meta": {
        "request_reference": "235chjz9h-c893v86"
    },
    "data": {
        "id": 3450345,
        "transaction_sku": "GREEN-BALL",
        "quantity": 4,
        "discount_type": "percentage",
        "discount": 1.5,
        "net_unit_principal": 12,
        "status": "active"
    }
}

Cancel Order Line

PUT /v1/orders/goodsouts/:id/lines/:lineId/cancel

Cancel a order goodsout line.

Parameter Regular Expressions

  • :id: [1-9][0-9]{0,}
  • :lineId: [1-9][0-9]{0,}

Request Body

CancelGoodsoutLine

Return Type

OrderGoodsoutLines

Types for the Request Body

CancelGoodsoutLine (root level)

KeyDescriptionTypesRestrictions
reasonReason for canceling the line.stringrequired
not null
min length is 1
max length is 250

Rate limit cost

Each call to this endpoint deducts 2 credits from your request bucket.

Scopes

This endpoint is only available for users with scope APP::ORDERS::MANAGE.

<?php

// Instantiate a GuzzleHttp client
$client = new \GuzzleHttp\Client();

// Make the request
$response = $client->request("PUT", "https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines/3450345/cancel", [
    "body" => json_encode([
        "reason" => "Item no longer wanted.",
    ]),
    "headers" => [
        "Content-Type" => "application/json",
        "Access-Token" => "my-token-from-login",
    ],
]);

// Process the response
$responseBody = json_decode($response->getBody(), true);
require 'rest-client'
require 'json'

# Make the request
response = RestClient.put 'https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines/3450345/cancel', {
  reason: "Item no longer wanted.",
}, {
  access_token: 'my-token-from-login',
  content_type: :json,
  accept: :json
}

# Process the response
puts response.body
// Require the node HTTP module
var request = require("request");

// Make the request
request({
    method: "PUT",
    json: true,
    uri: "https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines/3450345/cancel",
    body: {
        "reason": "Item no longer wanted."
    },
    headers: {
        "Access-Token": "my-token-from-login",
        "Content-Type": "application/json",
    },
    (error, response, body) => {
        // Process the response
        console.log(body);
    },
});
# Make the request
curl --location --request PUT 'https://public-api.bladepro.io/v1/orders/goodsouts/1234567/lines/3450345/cancel' \
--header 'Content-Type: application/json' \
--header 'Access-Token: my-token-from-login' \
--data-raw '{
    "reason": "Item no longer wanted."
}'

Example result:

{
    "meta": {
        "request_reference": "235chjz9h-c893v86"
    },
    "data": {
        "id": 3450345,
        "transaction_sku": "GREEN-BALL",
        "quantity": 4,
        "discount_type": "percentage",
        "discount": 1.5,
        "net_unit_principal": 12,
        "status": "active"
    }
}