[1.23.0] Address book

Warning!

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

AddressBook resource represents an address book assigned to organization


On this page

 

Structure

AddressBook resource has the following attributes:

AttributeTypeDescriptionAvailability
idIntegerunique identifierPL, IT
nameString

name of entry, unique in the context of the organization.

PL, IT
first_nameStringFirst namePL, IT
last_nameStringLast namePL, IT
phoneStringPhonePL, IT
emailStringE-mail addressPL, IT
organization_idIntegerorganization ID which owns this entryPL, IT
main_addressAddressAddressee's main addressPL, IT
delivery_addressAddressShipment delivery addressPL, IT
sender_parcelBooleanPaczkomat parcel station shipment senderPL, IT
sender_courierBooleanCourier shipment senderPL, IT
sender_letterBooleanLetter shipment senderPL, IT
kindStringType of entryPL, IT
company_nameStringCompany namePL, IT
preferred_dropoff_pointStringPreferred shipping pointPL, IT
created_atDateTimeAddress book creation date and time. PL, IT
updated_atDateTimeLast address book update date and time.PL, IT

AddressBook resource example JSON format:

{ 
         "id":5,
         "first_name":"Jan",
         "last_name":"Nowak",
         "email":"jan@nowak.pl",
         "phone":"123456789",
         "created_at":"2016-02-24T09:22:27.212+01:00",
         "updated_at":"2016-02-24T09:22:27.212+01:00",
         "organization_id":1,
         "name":"Nowak Corp",
         "sender_parcel":false,
         "sender_courier":false,
         "sender_letter":true,
         "kind": "sender",
         "company_name": "MyCompanyName",
         "preferred_dropoff_point": "KRA120",
         "main_address":{
            "id": "123",
            "street": "Malborska",
            "building_number": "130",
            "city":"Warsaw","id": "123",
            "post_code":"33-666",
            "country_code":"PO"
         },
         "delivery_address":{
            "id": "123",
            "street": "Malborska",
            "building_number": "140",
            "city":"Cracow",
            "post_code":"66-666",
            "country_code":"AZ"
         }
      }



Authentication

Resource access requires an active access token.



Address book list

Address book list within the given organization:

GET /v1/organizations/:organization_id/address_books

Request example

curl -X GET https://api-shipx-pl.easypack24.net/v1/organizations/1/address_books -H "Authorization: Bearer token" -H "Content-Type: application/json"

Response

HTTP/1.1 200 OK
Content-Type: application/json
{  
   "href":"https://api-shipx-pl.easypack24.net/v1/address_books",
   "count":1,
   "page":1,
   "per_page":30,
   "items":[  
      {  
         "id":5,
         "first_name":"Jan",
         "last_name":"Nowak",
         "email":"jan@nowak.pl",
         "phone":"123456789",
         "created_at":"2016-02-24T09:22:27.212+01:00",
         "updated_at":"2016-02-24T09:22:27.212+01:00",
         "organization_id":1,
         "name":"Nowak Corp",
         "sender_parcel":false,
         "sender_courier":false,
         "sender_letter":true,
		 "kind": "sender",
  		 "company_name": "MyCompanyName",
    	 "preferred_dropoff_point": "KRA120",
		 "main_address":{
			"id": "123",
            "street": "Malborska",
    		"building_number": "130",
            "city":"Warsaw","id": "123",
            "post_code":"33-666",
            "country_code":"PO"
         },
         "delivery_address":{
			"id": "123",
            "street": "Malborska",
    		"building_number": "140",
            "city":"Cracow",
            "post_code":"66-666",
            "country_code":"AZ"
         }
      }
   ]
}



Address book details

Retrieving address book information to which the user has access to

GET /v1/address_books/:id

Request example

curl -X GET https://api-shipx-pl.easypack24.net/v1/address_books/1 -H 'Authorization: Bearer token' -H 'Content-Type: application/json'

Response

HTTP/1.1  
Content-Type: application/json
{
  "id": 6,
  "first_name": "Jan",
  "last_name": "nowak",
  "email": "jan@nowak.pl",
  "phone": "123456789",
  "created_at": "2016-02-24T09:22:35.032+01:00",
  "updated_at": "2016-02-24T09:22:35.032+01:00",
  "organization_id": 1,
  "name": "Nowak Corp",
  "sender_parcel": true,
  "sender_courier": false,
  "sender_letter": true,
  "kind": "receiver",
  "company_name": "MyCompanyName",
  "preferred_dropoff_point": "KRA120",
  "main_address": {
	"id": "123",
    "street": "Malborska",
    "building_number": "130",
    "city": "Cracow",
    "post_code": "33-666",
    "country_code": "PO"
  },
  "delivery_address": {
	"id": "123",
    "street": "Malborska",
    "building_number": "130",
    "city": "Warsow",
    "post_code": "66-666",
    "country_code": "AZ"
  }
}



Address book creation

Creating a new address book for organization

POST v1/organizations/:organization_id/address_books

Parameters

ParameterTypeDescriptionAvailability
nameString

The attribute is required.

  • Maximum length: 255
  • Unique in the context of the organization    
PL, IT
first_nameString

The attribute is required.

  • Maximum length: 255
PL, IT
last_nameString

The attribute is required.

  • Maksymalnie 255 znaków
PL, IT
phoneString

The attribute is required.

  • Maximum length: 255
  • 9 characters  
  • Digits only  
PL, IT
emailString

The attribute is required.

  • Maksymalnie 255 znaków
  • Format consistent with RFC 5322 and RFC 5321
PL, IT
kindString

The attribute is required.

  • Maximum length: 255
  • Accepted values (sender, receiver)
PL, IT
company_nameString

The attribute is not required.

  • Maximum length: 255
PL, IT

preferred_dropoff_point 

String

The attribute is not required.

  • Maximum length: 255
PL, IT
main_address

Address

The attribute is required.

PL, IT
delivery_addressAddress

The attribute is required.

PL, IT
sender_parcelBoolean

The attribute is not required.

  • Default value: false
PL, IT
sender_courierBoolean

The attribute is not required.

  • Default value: false
PL, IT
sender_letterBoolean

The attribute is not required.

  • Default value: false
PL, IT

Request example

curl -X POST https://api-shipx-pl.easypack24.net/v1/organizations/1/address_books -H 'Authorization: Bearer token' -H 'Content-Type: application/json' -d '{
  "name": "Nowak Corp",
  "first_name": "Jan",
  "last_name": "Nowak",
  "email": "jan@nowak.com",
  "phone": "123456789",
  "sender_parcel": true,
  "sender_letter": true,
  "kind": "sender",
  "company_name": "MyCompanyName",
  "preferred_dropoff_point": "KRA120",
  "main_address": {
    "street": "Malborska",
    "building_number": "130",
    "city": "Warsaw",
    "post_code": "33-666",
    "country_code": "PO"
  },
  "delivery_address": {
 	"street": "Malborska",
    "building_number": "130",
    "city": "Cracow",
    "post_code": "66-666",
    "country_code": "AZ"
  }
}'

Response

HTTP/1.1  
Content-Type: application/json
{
  "id": 7,
  "first_name": "Jan",
  "last_name": "Nowak",
  "email": "jan@nowak.com",
  "phone": "123456789",
  "created_at": "2016-02-24T10:38:03.835+01:00",
  "updated_at": "2016-02-24T10:38:03.835+01:00",
  "organization_id": 1,
  "name": "Nowak Corp",
  "sender_parcel": true,
  "sender_courier": false,
  "sender_letter": true,
  "kind": "sender",
  "company_name": "MyCompanyName",
  "preferred_dropoff_point": "KRA120",
  "main_address": {
	"id": "123",
    "street": "Malborska",
    "building_number": "130",
    "city": "Warsaw",
    "post_code": "33-666",
    "country_code": "PO"
  },
  "delivery_address": {
	"id": "123",
    "street": "Malborska",
    "building_number": "130",
    "city": "Cracow",
    "post_code": "66-666",
    "country_code": "AZ"
  }
}



Address book editing

Edition of an existing address book

PUT /v1/address_books/:id

Parameters

ParameterTypeDescriptionAvailability
nameString

The attribute is required.

  • Maximum length: 255
  • Unique in the context of the organization    
PL, IT
first_nameString

The attribute is required.

  • Maximum length: 255
PL, IT
last_nameString

The attribute is required.

  • Maximum length: 255
PL, IT
phoneString

The attribute is required.

  • Maximum length: 255
  • 9 characters  
  • Digits only  
PL, IT
emailString

The attribute is required.

  • Maximum length: 255
  • Format consistent with RFC 5322 and RFC 5321
PL, IT
kindString

The attribute is required.

  • Maximum length: 255
  • Accepted values (sender, receiver)
PL, IT
company_nameString

The attribute is not required.

  • Maximum length: 255
PL, IT
preferred_dropoff_pointString

The attribute is not required.

  • Maximum length: 255
PL, IT
main_addressAddress

The attribute is required.

PL, IT
delivery_addressAddress

The attribute is required.

PL, IT
sender_parcelBoolean

The attribute is not required.

  • Default value: false
PL, IT
sender_courierBoolean

The attribute is not required.

  • Default value: false
PL, IT
sender_letterBoolean

The attribute is not required.

  • Default value: false
PL, IT

Request example

curl -X POST https://api-shipx-pl.easypack24.net/v1/address_books/1 -H 'Authorization: Bearer token' -H 'Content-Type: application/json' -d '{
  "name": "New name",
  "first_name": "John",
  "last_name": "Smith",
  "email": "some@email.pl",
  "phone": "123456798",
  "sender_courier": true,
  "kind": "receiver",
  "company_name": "MyCompanyName",
  "preferred_dropoff_point": "KRA120",
  "main_address": {
	"id": "123",
    "street": "Malborska",
    "building_number": "130",
    "city": "Warsaw",
    "post_code": "33-333",
    "country_code": "PL"
  },
  "delivery_address": {
	"id": "123",
    "street": "Malborska",
    "building_number": "134",
    "city": "Warsaw",
    "post_code": "33-333",
    "country_code": "PL"
  }
}'

Response

HTTP/1.1  
Content-Type: application/json; charset=utf-8
{
  "id": 7,
  "first_name": "Jan",
  "last_name": "Nowak",
  "email": "jan@nowak.com",
  "phone": "123456789",
  "created_at": "2016-02-24T10:38:03.835+01:00",
  "updated_at": "2016-02-24T10:38:03.835+01:00",
  "organization_id": 1,
  "name": "Nowak Corp",
  "sender_parcel": true,
  "sender_courier": false,
  "sender_letter": true,
  "kind": "receiver",
  "company_name": "MyCompanyName",
  "preferred_dropoff_point": "KRA120",
  "main_address": {
	"id": "123",
    "street": "Malborska",
    "building_number": "130",
    "city": "Warsaw",
    "post_code": "33-666",
    "country_code": "PO"
  },
  "delivery_address": {
	"id": "123",
    "street": "Malborska",
    "building_number": "140",
    "city": "Cracow",
    "post_code": "66-666",
    "country_code": "AZ"
  }
}



Address book deletion

Deleting an existing address book

DELETE /v1/address_books/:id

Request example

DELETE /v1/address_books/123

Response

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