Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


The Batch resource is used to create and view multiple shipments in batches. In the asynchronous mode, after validationshipment processing, each shipment is processed in a separate thread, and consequently, feedback is sent to WebHooks separately separately, because of which webhooks will be sent for each shipment .

PanelbgColor#f0f0f0titleBGColor#f0f0f0title

separately.


On this page

Table of Contents
minLevel2
 
The

Structure

Batch resource has the following attributes:

Attribute

Type

Description

id

Integer

Object

Batch ID

status

String

Shipment processing

Batch status

shipments

Array[Shipment]

Shipments

Shipment object array

created_at

DateTime

Date createdSample

Batch creation date and time

updated_at

DateTime 

Date updated

Batch last update date and time

Batch resource in

the

JSON format:

Code Block
languagejson
{
  "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

provision of the correct and valid

a valid access token.


Creating shipments in batches

Info

titleNote! Debit clients

Warning debit clients!

After creating a shipment

,

we do not return prices for debit clients.


The rate attribute takes the null value

Creating shipments in batches

code

The rate attribute is null.

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

Parameters

Parameter

Type

Description

Validation

only_choice_of_offer

Boolean

Setting the parameter

to

to true

makes

 results in the offer

in all shipments

being selected for the

stated

given service

,

but

it will

not

be automatically

being paid for.


Such

The shipment has to be paid for before the

end of the offer's validity term by completing the operations  ().

This parameter can also be set separately for each shipment (in such a case the parameter set in the shipment has a higher priority).

The attribute


is

not
required

optional.

  • Default


value
  • false

shipments

Array[Hash]



The attribute is optional..

  • Minimum 1

  • Maximum 2500


Shipment parameters.

Parameter

Type

Description

id

String

Required. Unique shipment ID

of the given shipment, which allows for returning to the user the information about any validation errors assigned to the particular shipment. The ID is not saved in the database and

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

the

an already created

shipment

batch.

...

...

The other parameters of a simplified shipment described at 

Sample request

code

Other parameters are described in: [1.9.0] Creating a shipment in the simplified mode

The attribute is not required.

• Minimum 1

• Maximum               

2500

Example request

Code Block
languagejson
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
", "reference": "Test
",
      "custom_attributes": {
        "target_point": "
KRA012
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",

"reference":
 
"Test",
     
"custom_attributes": {
        "target_point": "
KRA012
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 

Response

Code Block
languagejson
HTTP/1.1 201 Created
Content-Type: application/json
{
  "href": "https://api-shipx-pl.easypack24.net/v1/batches/
1672413
35",
  "id": 
1672413
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": "
2021
2017-
08
06-
11T13
12T14:
12
19:
50
20.
325
432+02:00",
  "updated_at": "
2021
2017-
08
06-
11T13
12T14:
12
19:
50
20.
325
432+02:00"
}

Information about errors

The server may return the following errors

Warning

Error information

  • validation_failed -

validation error

  • request parameters are incorrect.

  • forbidden - the

action is unavailable

  • user has insufficient permission for the

token provided

  • given action

  • token_invalid -

the user does not have access rights to the specified

  • user token is invalid for the given organization

Viewing batch shipments


Code Block
languagejson
GET /v1/batches/:id
Sample

Example request

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

Response

Code Block
languagejson
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"
}

Information about errors

The server may return the following errors•

Warning

Error information

  • resource_not_found -

in the event that to the batch does not exist

  • The batch doesn't exist.

  • token_invalid - The user token is invalid or the user

does not have

  • has no access

rights

  • to the

specified organization

  • given batch