Versions Compared

Key

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


Info

Warning!

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

ShipmentTemplate resource object represents a serialized shipment template in the context of the organization that created it.


On this page

Table of Contents

Structure

ShipmentTemplate resource has the following attributes:

Attribute

Type

Description

Accepted values

Availability

name

String

Template name

PL, IT

status

String

Status

activated, suspended

PL, IT

description

String

Template description

PL, IT

serialized_data

JSON

Serialized Shipment object (Shipment API)

PL, IT

updated_at

DateTime

Last template update date and time.

PL, IT

created_at

DateTime

Template creation date and time.

PL, IT

ShipmentTemplate resource example JSON format:

Code Block
languagejson
{
    "href": "https://api-shipx-pl.easypack24.net/v1/shipment_templates/1",
    "id": 1,
    "organization_id": "1",
    "status": "activated",
    "description": "description...",
    "serialized_data": {...},
    "organization": { ... },
    "updated_at": "2015-09-29T15:22:00.000+02:00",
    "created_at": "2015-09-29T15:22:00.000+02:00"
}

Authentication

Resource access requires an active access token.


Template List

Template list within the given organization:

Code Block
languagejson
GET /v1/organizations/:organization_id/shipment_templates

Request example

Code Block
languagejson
curl -X GET https://api-shipx-pl.easypack24.net/v1/organizations/1/shipment_templates -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/organizations/1/shipment_templates",
    "count": 15,
    "per_page": 30,
    "page": 1,
    "items": [
        { 
			"href": "https://api-shipx-pl.easypack24.net/v1/shipment_templates/1", 
			"id": 1, "organization_id": "1", 
			"status": "activated", 
			"description": "description...", 
			"serialized_data": {...}, 
			"organization": { ... }, 
			"updated_at": "2015-09-29T15:22:00.000+02:00", 
			"created_at": "2015-09-29T15:22:00.000+02:00" 
		}
    ]
}

Warning

Error information

The response can contain the following errors:

  • resource_not_found - organization for which the user wants to retrieve the template list doesn't exist or the user has no access to it.


Template details

Retrieving template information to which the user has access to

Code Block
languagejson
GET /v1/shipment_templates/:id

Request example

Code Block
languagejson
curl -X GET https://api-shipx-pl.easypack24.net/v1/shipment_templates/1 -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/shipment_templates/1",
   "id": 1,
   "status": "activated",
   "description": "(API Tests)",
   "name": "Inittec Sp. z o.o. ",
   "serialized_data": { ... },
   "organization": { ... },
   "created_at": "2016-03-22T09:31:28.609+01:00",
   "updated_at": "2016-03-22T09:31:28.609+01:00"
}

Warning

Error information

The response can contain the following errors:

  • resource_not_found - template doesn't exist or the user has no access to it.


Template Creation

Creating a new template

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

Parameters

Parameter

Type

Description

Validation

Availability

name

String

Template name

Required parameter.

  • Maximum length: 255

PL, IT

status

String

Template status

Required parameter.

  • Accepted values (ACTIVATED, SUSPENDED)

PL, IT

description

String

Template description

Required parameter.

  • Maximum length: 255

PL, IT

serialized_data

Shipment

serialized Shipment object

Required parameter.

PL, IT

Request example

Code Block
languagejson
POST https://api-shipx-pl.easypack24.net/v1/organizations/1/shipment_templates
{
    "name":"template name", 
    "status":"suspended", 
    "description":"description...", 
    "serialized_data": {
        "receiver": {
            "email": "paczkomat@test.pl",
            "phone": "888000022"
        },
        "parcels": { "template": "small"}
    }
}

Response

Code Block
languagejson
HTTP/1.1 200 OK
Content-Type: application/json
{
  "href": "https://api-shipx-pl.easypack24.net/v1/shipment_templates/6",
  "id": 6,
  "name": "non-active",
  "status": "suspended",
  "description": "description...",
  "organization": {
    ...
  },
  "template": {
    "status": "created",
    "service": null,
    "custom_attributes": {},
    "cod": {
      "amount": null,
      "currency": null
    },
    "insurance": {
      "amount": null,
      "currency": null
    },
    "additional_services": [],
    "reference": null,
    "is_return": false,
    "parcels": [
      {
        "id": null,
        "template": "small",
        "dimensions": {
          "length": 380,
          "width": 640,
          "height": 80,
          "unit": "mm"
        },
        "weight": {
          "amount": 25,
          "unit": "kg"
        },
        "tracking_number": null
      }
    ],
    "sender": null,
    "receiver": {
      "id": null,
      "name": null,
      "company_name": null,
      "first_name": null,
      "last_name": null,
      "email": "paczkomat@test.pl",
      "phone": "888000022",
      "address": null
    }
  },
  "created_at": "2016-10-04T12:43:37.454+02:00",
  "updated_at": "2016-10-04T12:43:37.454+02:00"
}

Warning

Error information

  • validation_failed - request data is invalid. Details are available in the details  field,

  • resource_not_found - organization doesn't exist or the user has no access to it.


Template Editing

Edition of an existing template

Code Block
languagejson
PUT /v1/shipment_templates/:id

Parameters

Parameter

Type

Description

Validation

Availability

name

String

Template Name

Optional parameter.

  • Maximum length: 255

PL, IT

status

String

Template status

Optional parameter.

  • Accepted values (ACTIVATED, SUSPENDED

PL, IT

description

String

Template description

Optional parameter.

  • Maximum length: 255

PL, IT

serialized_data

Shipment

serialized Shipment object

Optional parameter.

PL, IT

Request example

Code Block
languagejson
curl -X PUT https://api-shipx-pl.easypack24.net/v1/shipment_templates/1 -H "Authorization: Bearer token" -H "Content-Type: application/json" -d '{
	"name":"szablon_1", 
	"status":"activated", 
	"description":"description...", 
	"serialized_data": { ... } 
}' 

Response

Code Block
languagejson
HTTP/1.1 200 OK
Content-Type: application/json
{
   "href": "https://api-shipx-pl.easypack24.net/v1/shipment_templates/1",
   "id": 1,
   "status": "activated",
   "description": "(API Tests)",
   "name": "Inittec Sp. z o.o. ",
   "serialized_data": { ... },
   "organization": { ... },
   "created_at": "2016-03-22T09:31:28.609+01:00",
   "updated_at": "2016-03-22T09:31:28.609+01:00"
}

Warning

Error information

  • validation_failed - request data is invalid. Details are available in the details  field,

  • resource_not_found - template doesn't exist or the user has no access to it.


Template Deletion

Deleting an existing template.

Code Block
languagejson
DELETE /v1/shipment_templates/:id

Request example

Code Block
languagejson
curl -X DELETE https://api-shipx-pl.easypack24.net/v1/shipment_templates/1 -H "Authorization: Bearer token" -H "Content-Type: application/json"

Response

Code Block
languagejson
HTTP/1.1 204 NO_CONTENT
Content-Type: application/json

Warning

Error information

  • resource_not_found - template doesn't exist or the user has no access to it.