Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
PanelbgColor#f0f0f0titleBGColor#f0f0f0title

Info

Warning Debit clients!

Dispatch order price calculation is available only for prepaid clients. Prices are not returned for postpaid (debit) clients.


On this page

Table of Contents
minLevel

Structure

2 
The

DispatchOrderPriceList

resource

 resource has the following attributes:

Attribute

Type

Description

total_success_count

Integer

Number

Amount of correctly processed shipments

total_error_count

Integer

Number

Amount of incorrectly processed shipments

total_price

Hash

Total

amount

price for courier pick-up

price_list

Hash

Courier pick-up

pricelist

price list

invalid_shipments

Hash

Unprocessed shipment errors

Sample

DispatchOrderPriceList resource in

the

JSON format:

Code Block
languagejson
{
    "total_success_count": 3,
    "total_error_count": 1,
    "total_price": {
        "amount": 20.3,
        "currency": "PLN"
    },
    "price_list": {
        "courier": {
            "count": 1,
            "price": {
                "amount": "12",
                "currency": "PLN"
            },
            "shipments": [
                24921
            ]
        },
        "locker": {
            "count": 1,
            "price": {
                "amount": "4.30",
                "currency": "PLN"
            },
            "shipments": [
                24907
            ]
        }
        "allegro": {
            "count": 1,
            "price": {
                "amount": "4.30",
                "currency": "PLN"
            },
            "shipments": [
                24908
            ]
        }
    },
    "invalid_shipments": {
        "24906": [
            "already_dispatched"
        ]
    }
}

Authentication

Access to the resource

and its methods requires provision of the correct and valid

requires a valid access token.

Recalculating collection order prices

Dispatch Order price calculation

Code Block
languagejson
POST /v1/organizations/:organization_id/dispatch_orders/calculate

Parameters

Parameter

Type

Description

Validation

dispatch_point_id

Integer

ID of the dispatch point

Dispatch Point identifier, from which the shipment is to be collected from (the dispatch point address will become the

collection

dispatch order address).

The attribute is

Attribute not required.

shipments

Array[Integer]

List of shipment IDs for which the

collection

dispatch order is to be created for.

The

Required attribute

is required

.

• Parcels must
  • Shipments have to be in confirmed status and

cannot be assigned to a different collection
  • not belong to another dispatch order in the following statuses new, sent, accepted or done

status
  • .

Sample request

Request example

Code Block
languagejson
curl -X POST https://api-shipx-pl.easypack24.net/v1/organizations/1/dispatch_orders/calculate -H '
authorization
Authorization: Bearer token' -H '
content
Content-
type
Type: application/json' -d '{
  "dispatch_point_id": 10,
  "shipments": [24907, 24908, 24906, 24918, 24921]
}'

Response

Code Block
languagejson
HTTP/1.1 200 OK
Content-Type: application/json
{
    "total_success_count": 3,
    "total_error_count": 2,
    "total_price": {
        "amount": 16.3,
        "currency": "PLN"
    },
    "price_list": {
        "courier": {
            "count": 1,
            "price": {
                "amount": "12",
                "currency": "PLN"
            },
            "shipments": [
                24921
            ]
        },
        "locker": {
            "count": 2,
            "price": {
                "amount": "4.30",
                "currency": "PLN"
            },
            "shipments": [
                24907,
                24908
            ]
        }
    },
    "invalid_shipments": {
        "24906": [
            "already_dispatched"
        ],
        "24918": [
            "invalid_status"
        ]
    }
}

Warning

Error Information

about errors

The server may return the following errors

  • validation_failed - validation error

  • forbidden -

the user

  •   user does not have access

rights

  • to the

specified

  • given organization

  • token_invalid -

the

  • token is

incorrect

  • invalid