Packeta API
Packeta API is available through two interfaces:
Both interfaces provide identical functionality. For the list of available API methods see the API reference.
Testing
Packeta does not have a sanbox environment.
You can use your production account for testing purposes, as no charges apply unless a packet physically enters the Packeta network.
To avoid affecting live operations, consider creating a dedicated testing sender.
See also:
SOAP
Endpoint
- WSDL:
https://www.zasilkovna.cz/api/soap.wsdl - WSDL for PHP (32-bit):
https://www.zasilkovna.cz/api/soap-php-bugfix.wsdl
The native PHP SoapClient tends to fail at processing 64-bit integers on 32-bit systems. Therefore, for such systems, we recommend using our bugfix WSDL for PHP, where the unsignedLong type is replaced with string.
Packet IDs should always be handled as string values, as the standard signedInt may be incapable of holding the value.
Example requests
Example createPacket() request
createPacket() request- C#
- PHP
using System;
using System.ServiceModel;
namespace ConsoleApplication1
{
using Packeta;
class Program
{
static void Main(string[] args)
{
Packeta.PacketaClient gw = new PacketaClient();
string apiPassword = "{{API_PASSWORD}}";
PacketAttributes attrs = new PacketAttributes();
attrs.number = "123456";
attrs.name = "John";
attrs.surname = "Doe";
attrs.email = "example@packetatest.com";
attrs.phone = "+420777123456";
attrs.addressId = 79; //Praha 4, Pražského povstání, Na Pankráci 969/97
attrs.cod = 145.55;
attrs.value = 145.55;
attrs.weight = 2;
attrs.eshop = "MyEshop";
PacketIdDetail packet;
try
{
packet = gw.createPacket(apiPassword, attrs);
}
catch (FaultException<PacketAttributesFault> e) {
// TODO: process error
}
}
}
}
<?php
$gw = new SoapClient("https://www.zasilkovna.cz/api/soap.wsdl");
$apiPassword = "1234567890abcdef1234567890abcdef";
try {
$packet = $gw->createPacket($apiPassword, array(
'number' => "123456",
'name' => "John",
'surname' => "Doe",
'email' => "example@packetatest.com",
'phone' => "+420777123456",
'addressId' => 79,
'cod' => 145.55,
'value' => 145.55,
'weight' => 2,
'eshop' => "MyEshop"
));
} catch (SoapFault $e) {
var_dump($e->detail); // property detail contains error info
}
REST/XML
Endpoint
https://www.zasilkovna.cz/api/rest
Send an HTTP POST request with an XML body. The root element represents the API method name and its child elements represent the method arguments.
Example request
Example createPacket() request
createPacket() request- REST
<createPacket>
<apiPassword>{{API_PASSWORD}}</apiPassword>
<packetAttributes>
<number>123456</number>
<name>John</name>
<surname>Doe</surname>
<email>example@packetatest.com</email>
<phone>+420777123456</phone>
<addressId>79</addressId>
<cod>145.55</cod>
<value>145.55</value>
<weight>2</weight>
<eshop>{{SENDER_INDICATION}}</eshop>
</packetAttributes>
</createPacket>
The server's response is shaped in the same manner as the request, with the exception that the root element carries the name of the return type.