Page tree
Skip to end of metadata
Go to start of metadata

Collecting information about a particular template the user has access to:


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

On this page

 

Authentication

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

The resource has the following attributes:

AttributeType

Description

Acceptable values
nameString

Template name


statusString

Status

activated, suspended
descriptionString

Template description


serialized_data
JSON

serialized Shipment shipment object ([Shipment])


updated_at
DateTime

Last update of the user's profile.


created_at
DateTime

Date created of the user's profile.


Sample ShipmentTemplate resource in the JSON format:

{
    "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"
}

Downloading template

Collecting information about a particular template the user has access to:

GET /v1/shipment_templates/1

Sample request

curl https://api-shipx-pl.easypack24.net/v1/shipment_templates/1 -H "Authorization: Bearer ..."

Response

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"
}

Information about errors

The server may return the following errors

  • resource_not_found - in the event that the template does not exist or the user does not have access rights to the specified organization.

List of templates

List of templates within the given organization:

GET /v1/organizations/:organization_id/shipment_templates

Sample request

curl https://api-shipx-pl.easypack24.net/v1/organizations/1/shipment_templates -H "Authorization: Bearer ..."

Response

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/organizations/1/shipment_templates/123",
            "id": 123,
            ... other attribute omitted for brevity ....
        }
        ... other items omitted for brevity ...
    ]
}

Information about errors

  • resource_not_found - the organization the user wants to collect the list of shipments for does not exist or the user has no access to it.

Adding a template

Creating a new template

POST /v1/organizations/1/shipment_templates

Parameter

ParametrType

Description

Validation

nameString

Template name

The attribute is required.

• Maximum 255 characters

statusString

Template status

The attribute is required.

• Acceptable values (activated, suspended)

descriptionString

Template description

The attribute is required.

• Maximum 255 characters

serialized_dataShipment

Serialized Shipment object

The attribute is required.

Request example


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 

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"
}


Information about errors


    • validation_failed - data sent by the POST method are incorrect. Details contained in the response in the details field,
    • resource_not_found - the organization the user wants to collect the list of shipments for does not exist or the user has no access to it.



Removing a template

Removing an existing template assigned to the organization.

DELETE /v1/shipment_templates/1

Sample request

curl https://api-shipx-pl.easypack24.net/v1/shipment_templates/1 -H DELETE -H "Authorization: Bearer ..."

Response

HTTP/1.1 204 NO_CONTENT
Content-Type: application/json

Information about errors

  • resource_not_found - the template the user wants to collect the list of shipments for does not exist or the user has no access to it.



Editing a template

Creating a new template

PUT /v1/shipment_templates/:template_id

Parameters

ParameterType

Description

Validation

nameString

Template name

The attribute is not required.

• Maximum 255 characters

statusString

Template status

The attribute is not required.

• Acceptable values (ACTIVATED, SUSPENDED

descriptionString

Template description

The attribute is not required.

• Maximum 255 characters

serialized_dataShipment

Serialized Shipment object

The attribute is not required.

Sample request

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

Response

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"
}

Information about errors

  • validation_failed - data sent by the POST method are incorrect. Details contained in the response in the details field
  • resource_not_found - the template the user wants to collect the list of shipments for does not exist or the user has no access to it.
  • No labels