Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »


Parameters

The resource is responsible for generating prices for shipments, on the basis of their attributes, without the need to create them in Shipx.
Many shipments can be sent and the price will be returned separately for each of them.


On this page

 

The resource with prices for shipments has the following

AttributeDescription
idShipment ID. Required when converting prices for more than one shipment.
calculated_charge_amountTotal price for the shipment.
fuel_charge_amountFuel Fee
notification_charge_amountFee for additional notification
cod_charge_amountFee for a parcel with COD
insurance_charge_amountShipment insurance fee
calculated_charge_amount_non_commissionFee calculated on the basis of the parcel sender's price list (PRICE) and it determines the Amount without charged Margins for optional services - This amount currently results directly from the size of the shipment.


Sample resource in the JSON format:

[
    {
		"id": "SHIPMENT1",
        "calculated_charge_amount": "27.20",
        "fuel_charge_amount": "0.00",
        "notification_charge_amount": "0.00",
        "cod_charge_amount": "0.00",
        "insurance_charge_amount": "20.00",
        "calculated_charge_amount_non_commission": "7.20",
    },
    {
		"id": "SHIPMENT2",
        "calculated_charge_amount": "18.00",
        "fuel_charge_amount": null,
        "notification_charge_amount": null,
        "cod_charge_amount": null,
        "insurance_charge_amount": null,
        "calculated_charge_amount_non_commission": null,
    }
]


Authentication

Access to the resource and its methods requires provision of the correct and valid access token.

Recalculating prices for shipments

POST /v1/organizations/:organization_id/shipments/calculate

Parameters

ParameterTypeDescription
shipmentsArray[Hash]Includes shipment attributes for which the price should be calculated.

Request example

curl -X POST https://api-shipx-pl.easypack24.net/v1/organizations/1/shipments/calculate -H 'Authorization: Bearer token' -H 'content-type: application/json' -d '
{
"shipments": [
  {
  	"id": "SHIPMENT1",
    "receiver": {
      "email": "receiverrro32969504293051@example.com",
      "phone": "329695042",
      "first_name": "John Receiver32969504293051",
      "last_name": "Mc'Receiver32969504293051",
      "address":{
        "line1":"Ulica jakaś32969504293051",
        "line2":"Budynek32969504293051",
        "city":"Szczecin32969504293051",
        "post_code":"00-001",
        "country_code":"PL"
      }
    },
    "parcels": {
      "dimensions": {
        "length": "50",
        "width": "50",
        "height": "50",
        "unit": "mm"
      },
      "weight": {
        "amount": "5",
        "unit": "kg"
      }
    },
    "custom_attributes": {
          "target_point": "KRA010"
      },
      "insurance": {
          "amount": 25,
          "currency": "PLN"
    },
      "cod": {
          "amount": 10,
          "currency": "PLN"
      },
    "service": "inpost_locker_standard"
   },
   {
   	"id": "SHIPMENT2",
    "receiver": {
      "email": "receiverrro32969504293051@example.com",
      "phone": "329695042",
      "first_name": "John Receiver32969504293051",
      "last_name": "Mc'Receiver32969504293051",
      "address":{
        "line1":"Ulica jakaś32969504293051",
        "line2":"Budynek32969504293051",
        "city":"Szczecin32969504293051",
        "post_code":"00-001",
        "country_code":"PL"
      }
    },
    "parcels": {
      "dimensions": {
        "length": "50",
        "width": "50",
        "height": "50",
        "unit": "mm"
      },
      "weight": {
        "amount": "5",
        "unit": "kg"
      }
    },
    "custom_attributes": {
          "target_point": "KRA010"
      },
      "insurance": {
          "amount": 25,
          "currency": "PLN"
    },
      "cod": {
          "amount": 10,
          "currency": "PLN"
      },
    "service": "inpost_courier_standard"
   }
 ]
}

Response

HTTP/1.1 200 OK
Content-Type: application/json
 
[
    {
		"id": "SHIPMENT1",
        "calculated_charge_amount": "27.20",
        "fuel_charge_amount": "0.00",
        "notification_charge_amount": "0.00",
        "cod_charge_amount": "0.00",
        "insurance_charge_amount": "20.00",
        "calculated_charge_amount_non_commission": "7.20",
    },
    {
		"id": "SHIPMENT2",
        "calculated_charge_amount": "18.00",
        "fuel_charge_amount": null,
        "notification_charge_amount": null,
        "cod_charge_amount": null,
        "insurance_charge_amount": null,
        "calculated_charge_amount_non_commission": null,
    }
]

In the case the logistic system does not return the prices for the data sent, an error message will be returned for a single shipment:

[
    {
        "id": "SHIPMENT1",
        "calculated_charge_amount": "27.20",
        "fuel_charge_amount": "0.00",
        "notification_charge_amount": "0.00",
        "cod_charge_amount": "0.00",
        "insurance_charge_amount": "20.00",
        "calculated_charge_amount_non_commission": "7.20"
    },
    {
        "id": "SHIPMENT2",
        "key": "no_offers",
        "message": "External logistic system responded with no offers."
    }
]



  • No labels