Packetery API

We offer API interface using SOAP protocol or a REST interface using XML request bodies. Both offer the same functionality.

Please see API reference for more details.

SOAP

Warning: Native PHP SoapClient on 32bit systems fails at processing 64bit integers; please use the bugfix WSDL for PHP, where the unsignedLong type is replaced by string. It is important to treat packet IDs as string, since the standard signedInt would not be able to contain the value.

Example:

using System;
using System.ServiceModel;

namespace ConsoleApplication1
{
    using Packetery;
    class Program
    {
        static void Main(string[] args)
        {
            Packetery.PacketeryClient gw = new PacketeryClient();
            string apiPassword = "1234567890abcdef1234567890abcdef";

            PacketAttributes attrs = new PacketAttributes();
            attrs.number = "123456";
            attrs.name = "Petr";
            attrs.surname = "Novák";
            attrs.email = "[email protected]";
            attrs.phone = "+420777123456";
            attrs.addressId = 79; //Praha 4, Pražského povstání, Na Pankráci 969/97
            attrs.cod = 145;
            attrs.value = 145.55M;
            attrs.eshop = "muj-eshop.cz";

            PacketIdDetail packet;
            try
            {
                packet = gw.createPacket(apiPassword, attrs);
            }
            catch (FaultException<PacketAttributesFault> e) {
                // TODO: process error
            }
        }
    }
}
<?php
$gw = new SoapClient("http://www.zasilkovna.cz/api/soap.wsdl");
$apiPassword = "1234567890abcdef1234567890abcdef";

try {
    $packet = $gw->createPacket($apiPassword, array(
        'number' => "123456",
        'name' => "Petr",
        'surname' => "Novák",
        'email' => "[email protected]",
        'phone' => "+420777123456",
        'addressId' => 79,
        'cod' => 145,
        'value' => 145.55,
        'eshop' => "muj-eshop.cz"
    ));
}
catch(SoapFault $e) {
    var_dump($e->detail); // property detail contains error info
}

REST/XML

Always send a POST request with a XML document body, using the requested API method as the root element's name and method's arguments as subelements.

Example:

<createPacket>
    <apiPassword>__API_PASSWORD__</apiPassword>
    <packetAttributes>
        <number>123456</number>
        <name>Petr</name>
        <surname>Novák</surname>
        <email>[email protected]</email>
        <addressId>79</addressId>
        <value>145.55</value>
        <eshop>muj-eshop.cz</eshop>
    </packetAttributes>
</createPacket>

The server response follows the same rules as the request, except the root element is the name of the return type.

Testing

You can freely use your standard account for testing purposes. We do not charge anything for packets that were not physically admitted to one of our branches.

However if you insist on testing on a different account (you don't wish to pollute your packet history), just ask our Customer Service for one.