Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Version published after converting to the new editor


Info
titleWarning!

Resource is available only in the following countries: PL, IT

Batch resource is used to create and view shipments in batches. In the asynchronous shipment processing each shipment is processed separately, because of which webhooks will be sent for each shipment separately.




Panel
bgColor#f0f0f0
titleBGColor#f0f0f0
titleOn this page

Table of Contents
minLevel2
 


Structure

Batch resource has the following attributes:

AttributeTypeDescriptionAvailability
idIntegerBatch IDPL, IT
statusStringBatch statusPL, IT
shipmentsArray[Shipment]Shipment object arrayPL, IT
created_atDateTimeBatch creation date and timePL, IT
updated_atDateTime Batch last update date and timePL, IT

Batch resource in JSON format:

Code Block
{
  "href": "https://api-shipx-pl.easypack24.net/v1/batches/16",
  "id": 16,
  "status": "done",
  "shipments": [
    {
      "href": "https://api-shipx-pl.easypack24.net/v1/shipments/151",
      "id": 151,
      "status": "confirmed",
      "tracking_number": "633100159730624319900067"
    },
    {
      "href": "https://api-shipx-pl.easypack24.net/v1/shipments/150",
      "id": 150,
      "status": "confirmed",
	  "tracking_number": "633100159730624319900068"
    }
  ],
  "created_at": "2017-06-08T14:17:25.675+02:00",
  "updated_at": "2017-06-08T14:17:25.675+02:00"
}


Authentication

Access to the resource requires a valid acces tokenu.



Creating shipments in batches

Info
titleUwaga! Klienci debetowi

After creating a shipment we do not return prices for debit clients. The rate attribute is null


Code Block
POST /v1/organizations/:organization_id/batches

Parameters

ParameterTypeDescriptionValidationAvailability
only_choice_of_offerBoolean

Setting the parameter to true results in the offer being selected for the given service but not being paid for. The shipment has to be paid for before the offer expiry.  (Shipment buy offer)

The attribute is optional.

  • Default false
PL, IT
shipmentsArray[Hash]


ParametrTypeOpis
idStringRequired. Unique shipment ID within the batch that allows for validation errors to be returned in connection to a specific shipment. ID is not persisted in the database and is not returned as an attribute of an already created batch.
......Other parameters are described in: [1.23.0] Shipment creation in simplified mode


The attribute is optional..

  • Minimum 1
  • Maximum 2500


PL, IT

Example request

Code Block
curl -X POST https://api-shipx-pl.easypack24.net/v1/organizations/1/batches -H 'Authorization: Bearer token' -H 'content-type: application/json' -d '{ 
  "only_choice_of_offer": false,
  "shipments": [
    {
      "id": 1,
      "service": "inpost_locker_standard",
      "custom_attributes": {
        "target_point": "KRA010"
      },
      "parcels":{
        "template": "small"
      },
      "receiver": {
        "company_name": "Company name 1",
        "email": "sklep@inpost.pl",
        "phone": "888888888",
        "address": {
          "line1": "Zawila 65L",
          "city": "Krakow",
          "post_code": "30-390",
          "country_code": "PL"
        }
      },
      "sender": {
       "company_name": "Company name 2",
        "email": "sklep@inpost.pl",
        "phone": "999999999",
        "address": {
          "line1": "Zawila 65L",
          "city": "Krakow",
          "post_code": "30-390",
          "country_code": "PL"
        }
      },
      "cod": {
        "amount": 1,
        "currency": "PLN"
      },
      "insurance": {
        "amount": 23,
        "currency": "PLN"
      }
    },
    {
      "id": 2,
      "service": "inpost_locker_standard",
      "custom_attributes": {
        "target_point": "KRA010"
      },
      "parcels":{
        "template": "small"
      },
      "receiver": {
        "company_name": "Company name 1",
        "email": "sklep@inpost.pl",
        "phone": "888888888",
        "address": {
          "line1": "Zawila 65L",
          "city": "Krakow",
          "post_code": "30-390",
          "country_code": "PL"
        }
      },
      "sender": {
       "company_name": "Company name 2",
        "email": "sklep@inpost.pl",
        "phone": "999999999",
        "address": {
          "line1": "Zawila 65L",
          "city": "Krakow",
          "post_code": "30-390",
          "country_code": "PL"
        }
      },
      "cod": {
        "amount": 1,
        "currency": "PLN"
      },
      "insurance": {
        "amount": 23,
        "currency": "PLN"
      }
    }
  ]
}'

Response

Code Block
HTTP/1.1 201 Created
Content-Type: application/json
{
  "href": "https://api-shipx-pl.easypack24.net/v1/batches/35",
  "id": 35,
  "status": "in_progress",
  "shipments": [
    {
      "href": "https://api-shipx-pl.easypack24.net/v1/shipments/195",
      "id": 195,
      "status": "confirmed",
      "tracking_number": "520000017830390003337439"
    },
    {
      "href": "https://api-shipx-pl.easypack24.net/v1/shipments/195",
      "id": 195,
      "status": "offer_selected",
      "tracking_number": "520000017830390003337439"
    },
    {
      "href": "https://api-shipx-pl.easypack24.net/v1/shipments/196",
      "id": 196,
      "status": "create",
      "tracking_number": null
    }
  ],
  "created_at": "2017-06-12T14:19:20.432+02:00",
  "updated_at": "2017-06-12T14:19:20.432+02:00"
}

Error information

  • validation_failed - request parameters are incorrect.
  • forbidden - the user has insufficient permission for the given action
  • token_invalid - user token is invalid for the given organisation



Viewing batch shipments


Code Block
GET /v1/batches/:id

Example request

Code Block
curl -X GET https://api-shipx-pl.easypack24.net/v1/batches/16 -H 'Authorization: Bearer token' -H 'content-type: application/json' 

Response

Code Block
HTTP/1.1 200 OK
Content-Type: application/json
{
  "href": "https://api-shipx-pl.easypack24.net/v1/batches/16",
  "id": 16,
  "status": "done",
  "shipments": [
    {
      "href": "https://api-shipx-pl.easypack24.net/v1/shipments/151",
      "id": 151,
      "status": "confirmed",
      "tracking_number": "633100159730624319900067"
    },
    {
      "href": "https://api-shipx-pl.easypack24.net/v1/shipments/150",
      "id": 150,
      "status": "confirmed",
      "tracking_number": "633100159730624319900068"
    }
  ],
  "created_at": "2017-06-08T14:17:25.675+02:00",
  "updated_at": "2017-06-08T14:17:25.675+02:00"
}

Error information

  • resource_not_found - The batch doesn't exist.
  • token_invalid - The user token is invalid or the user has no access to the given batch