### Create Packet Claim With Password (C#) Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-creation/claim-assistant.mdx C# example demonstrating the setup for calling the createPacketClaimWithPassword service. ```APIDOC ## Claim Assistant - Create Packet Claim With Password (C#) ### Description This C# code snippet shows the initial setup for creating a service client to interact with the `createPacketClaimWithPassword` SOAP operation. ### Method SOAP Client Initialization ### Endpoint `https://www.zasilkovna.cz/api/soap` ### Code Structure ```csharp using System; using System.ServiceModel; using System.Threading.Tasks; using PacketeryService; // Assuming this namespace contains the generated client namespace PacketaClientExample { class Program { static async Task Main(string[] args) { BasicHttpsBinding binding = new BasicHttpsBinding(); EndpointAddress endpointAddress = new EndpointAddress("https://www.zasilkovna.cz/api/soap"); // Further client instantiation and method calls would follow here. // Example: // var client = new PacketeryServiceClient(binding, endpointAddress); // var result = await client.createPacketClaimWithPasswordAsync(...); } } } ``` ### Notes - This snippet focuses on the client setup. The actual method call and parameter passing would occur after this initialization. ``` -------------------------------- ### C# SOAP Client Setup Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-creation/carriers-pudos.mdx Basic C# code snippet showing the necessary using directives for setting up a SOAP client. This is a starting point for integrating with the SOAP API. ```csharp using System; using System.ServiceModel; ``` -------------------------------- ### Create Packet Claim with Password (C# Example) Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-creation/claim-assistant.mdx This C# example sets up the necessary binding and endpoint address to interact with the SOAP service for creating a packet claim with a password. It's a starting point for a C# client implementation. ```csharp using System; using System.ServiceModel; using System.Threading.Tasks; using PacketeryService; namespace PacketaClientExample { class Program { static async Task Main(string[] args) { BasicHttpsBinding binding = new BasicHttpsBinding(); EndpointAddress endpointAddress = new EndpointAddress("https://www.zasilkovna.cz/api/soap"); ``` -------------------------------- ### createPacketClaim() Request/Response Example Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-creation/claim-assistant.mdx This snippet shows an example of a request and response for the `createPacketClaim()` method, demonstrating how to generate a Claim Assistant parcel through the API. ```APIDOC ## POST /createPacketClaim ### Description Generates a Claim Assistant parcel that can be used by customers to return parcels to the sender. ### Method POST ### Endpoint /createPacketClaim ### Parameters #### Request Body - **apiPassword** (string) - Required - The API password for authentication. - **claimAttributes** (object) - Required - Contains attributes for the claim. - **number** (string) - Required - A unique identifier for the claim. - **email** (string) - Required - The email address of the customer. - **value** (number) - Optional - The value of the parcel. - **currency** (string) - Optional - The currency of the parcel value (e.g., CZK). - **eshop** (string) - Optional - The name of the e-shop. - **sendLabelToEmail** (boolean) - Optional - Whether to send the label to the customer's email. ### Request Example ```xml {{apiPassword}} claimNumber example@packetatest.com 100.00 CZK MyEshop false ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation (e.g., 'ok'). - **result** (object) - Contains the result of the operation. - **id** (string) - The unique ID of the generated parcel. - **barcode** (string) - The barcode for the parcel. - **barcodeText** (string) - The human-readable text of the barcode. #### Response Example ```xml ok 123456789 Z123456789 Z 12345 67890 ``` ``` -------------------------------- ### Branch Photo Example Source: https://github.com/packeta/api-documentation/blob/master/docs/pick-up-point-selection/branch-export-v5.mdx Provides URLs for different sizes of branch photos. Includes a thumbnail and a normal-sized image. ```json { "thumbnail":"https://www.zasilkovna.cz/images/branch/thumb/img_1.jpg", "normal":"https://www.zasilkovna.cz/images/branch/normal/img_1.jpg" } ``` -------------------------------- ### Create Packet Claim with Password (SOAP Example) Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-creation/claim-assistant.mdx This example demonstrates creating a packet claim with a password using SOAP. It includes the full SOAP envelope for both the request and response, detailing the structure and namespaces involved. ```xml {{apiPassword}} claimNumber umpa.lumpa@packetatest.com +420777777777 100 CZK MyEshop false 1234567890 Z1234567890 Z 123 4567 890 P186A9 ``` -------------------------------- ### Carrier Pick-up Points Widget Example Source: https://github.com/packeta/api-documentation/blob/master/docs/pick-up-point-selection/examples/carrier-pickup-points.mdx This example demonstrates how to implement the Packeta widget to display Carrier pick-up points. The widget can be configured to show both Packeta and external carrier pick-up points. ```html ``` -------------------------------- ### C# Basic Setup for Packeta API Client Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-creation/home-delivery.mdx This C# snippet provides the basic setup for creating a Packeta API client using WCF. It initializes the binding and endpoint address for the SOAP service. ```csharp using System; using System.ServiceModel; using System.Threading.Tasks; using PacketaService; namespace PacketaClientExample { class Program { static async Task Main(string[] args) { BasicHttpsBinding binding = new BasicHttpsBinding(); EndpointAddress endpointAddress = new EndpointAddress("https://www.zasilkovna.cz/api/soap"); const string apiPassword = "apiPassword"; ``` -------------------------------- ### Packet Tracking C# Example Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-tracking/tracking.mdx Example of how to use the `packetTracking` SOAP method in C#. ```APIDOC ## Packet Tracking with C# ### Description This example demonstrates how to call the `packetTracking` SOAP function asynchronously using C#. ### Code Example ```csharp using System; using System.ServiceModel; using System.Threading.Tasks; using PacketaService; namespace PacketaClientExample { class Program { static async Task Main(string[] args) { BasicHttpsBinding binding = new BasicHttpsBinding() { MaxReceivedMessageSize = int.MaxValue }; EndpointAddress endpointAddress = new EndpointAddress("https://www.zasilkovna.cz/api/soap"); string apiPassword = "apiPassword"; ulong packetId = 2400636120; PacketaClient client = new PacketaClient(binding, endpointAddress); try { packetTrackingResponse response = await client.packetTrackingAsync( new packetTrackingRequest(apiPassword, packetId) ); //Process response Console.WriteLine(response.packetTrackingResult[0]); } catch (Exception e) { Console.WriteLine(e.Message); } } } } ``` ``` -------------------------------- ### Packet Tracking Node.js Example Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-tracking/tracking.mdx Example of how to use the `packetTracking` REST method in Node.js. ```APIDOC ## Packet Tracking with Node.js ### Description This example demonstrates how to call the `packetTracking` REST endpoint using Node.js `fetch` and `xml2js` for XML parsing. ### Code Example ```javascript import { Builder, Parser } from "xml2js" const requestBody = { packetTracking: { apiPassword: "apiPassword", packetId: "1234567890" } } try { const response = await fetch( "https://www.zasilkovna.cz/api/rest", { method: "POST", body: new Builder().buildObject(requestBody) } ); const responseBody = await new Parser({ explicitArray: false }).parseStringPromise(await response.text()); //process response console.dir(responseBody, { depth: null }); } catch (exception) { console.log(exception); } ``` ``` -------------------------------- ### Example Iframe URL Source: https://github.com/packeta/api-documentation/blob/master/docs/address-delivery/address-delivery-widget.mdx Illustrates how the embeddable application's URL is constructed with query string parameters for configuration. ```html https://hd.widget.packeta.com/v6/#/?layout=hd&carrierId=80&apiKey=c65a2d0ee3cb844f&country=cz,sk ``` -------------------------------- ### Create Packet Claim With Password (PHP) Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-creation/claim-assistant.mdx PHP example demonstrating how to use the SoapClient to create a packet claim with a password. ```APIDOC ## Claim Assistant - Create Packet Claim With Password (PHP) ### Description This PHP code snippet shows how to instantiate a `SoapClient` and call the `createPacketClaimWithPassword` method to create a claim. ### Method SOAP Call ### Endpoint `https://www.zasilkovna.cz/api/soap.wsdl` ### Parameters - **apiPassword** (string) - Required - Your API password. - **claimAttributes** (array) - Required - An associative array containing claim details: - **number** (string) - Required - The claim number. - **email** (string) - Required - The customer's email. - **phone** (string) - Required - The customer's phone number. - **value** (string) - Required - The monetary value of the claim. - **currency** (string) - Required - The currency code. - **eshop** (string) - Required - The eshop name. - **consignCountry** (string) - Required - The country code of the consignment. - **sendEmailToCustomer** (boolean) - Optional - Whether to send an email to the customer. ### Request Example ```php '20220513001', 'email' => 'umpa.lumpa@packetatest.com', 'phone' => '603603603', 'value' => '100', 'currency' => 'CZK', 'eshop' => 'my-eshop.com', 'consignCountry' => 'CZ', 'sendEmailToCustomer' => false, ]; try { $client = new SoapClient("https://www.zasilkovna.cz/api/soap.wsdl"); $result = $client->createPacketClaimWithPassword($apiPassword, $claimAttributes); var_dump($result); } catch (SoapFault $e){ echo $e->getMessage(); if (isset($e->detail->PacketAttributesFault)) { var_dump($e->detail->PacketAttributesFault->attributes->fault); } elseif(isset($e->detail->IncorrectApiPasswordFault)) { var_dump('Incorrect API password.'); } } ?> ``` ### Response #### Success Response - The `$result` variable will contain the SOAP response object, which can be inspected using `var_dump()`. #### Error Handling - `SoapFault` exceptions are caught, and error messages are displayed. - Specific fault types like `PacketAttributesFault` and `IncorrectApiPasswordFault` are checked for detailed error information. ``` -------------------------------- ### SOAP Packet Tracking Request Example Source: https://github.com/packeta/api-documentation/blob/master/docs/packet_tracking/tracking.mdx This example demonstrates how to make a SOAP request to track a packet. It shows the structure of a typical SOAP envelope with packet tracking details. ```xml 2022-01-10T05:37:58 3 prepared for departure Zásilka byla připravena k odeslání na depu Zásilkovna, DEPO, Hůry, Hůry 238. 13854 0 2022-01-10T05:37:58 3 prepared for departure Zásilka byla připravena k odeslání na depu Zásilkovna, DEPO, Hůry, Hůry 238. 13854 15322 2022-01-10T08:20:13 4 departed Zásilka byla odeslána na pobočku Alzabox Prachatice, Krumlovská 1103 (Kaufland) 13854 15322 2022-01-10T10:43:00 5 ready for pickup Zásilka byla přijata na cílovém výdejním místě Alzabox Prachatice, Krumlovská 1103 (Kaufland). 15322 0 2022-01-10T15:34:06 7 delivered Zásilka byla vydána. 15322 0 ``` -------------------------------- ### Packeta Pick-up Point Widget Example Source: https://github.com/packeta/api-documentation/blob/master/docs/pick-up-point-selection/examples/packeta-pickup-points.mdx An example of how to implement the Packeta pick-up points widget on your website. Open the browser's developer console to see the returned object upon selection. ```javascript Packeta.Widget.pick(apiKey, callback, options*, inElement*) ``` -------------------------------- ### Packet Info Example Output (XML) Source: https://github.com/packeta/api-documentation/blob/master/docs/api-reference/api-methods-reference.mdx Example XML output for the packetInfo API call, detailing branch ID, weight, and courier information. ```xml ok 999 570 999 Example courier 12345678 987654321 1234567890 en https://www.example-courier/tracking/en/1234567890 cs https://www.example-courier/tracking/cs/1234567890 ``` -------------------------------- ### Carrier Information Example Source: https://github.com/packeta/api-documentation/blob/master/docs/pick-up-point-selection/branch-export-v5.mdx Provides an example of carrier data, including ID, name, and various operational flags and requirements. ```json [ { "id":"1", "name":"AT Austrian Post HD", "pickupPoints":"false", "apiAllowed":"true", "separateHouseNumber":"false", "customsDeclarations":"false", "requiresEmail":"true", "requiresPhone":"true", "requiresSize":"false", "disallowsCod":"false", "country":"at", "currency":"EUR", "maxWeight":"30", "labelRouting":"C38-***-080", "labelName":"AT Austrian Post HD" } ] ``` -------------------------------- ### Packet Tracking Request Examples (SOAP) Source: https://github.com/packeta/api-documentation/blob/master/docs/packet_tracking/tracking.mdx This section provides an example of a SOAP request and response for tracking packet information. ```APIDOC ## Packet Tracking Request (SOAP) ### Description Provides tracking information for a given packet ID. ### Method SOAP ### Endpoint https://www.zasilkovna.cz/api/soap ### Parameters #### Request Body - **apiPassword** (string) - Required - The API password for authentication. - **packetId** (string) - Required - The ID of the packet to track. ### Request Example ```xml apiPassword 1234567890 ``` ### Response #### Success Response - **packetTrackingResult** (object) - Contains an array of tracking records. - **record** (array) - Each record represents a tracking event. - **dateTime** (string) - The date and time of the tracking event. - **statusCode** (integer) - The status code of the tracking event. - **codeText** (string) - A short text description of the status code. - **statusText** (string) - A detailed text description of the status. - **branchId** (integer) - The ID of the branch associated with the event. - **destinationBranchId** (integer) - The ID of the destination branch. - **externalTrackingCode** (string or null) - An external tracking code, if available. ### Response Example ```xml 2022-01-10T05:37:58 3 prepared for departure Zásilka byla připravena k odeslání na depu Zásilkovna, DEPO, Hůry, Hůry 238. 13854 0 2022-01-10T05:37:58 3 prepared for departure Zásilka byla připravena k odeslání na depu Zásilkovna, DEPO, Hůry, Hůry 238. 13854 15322 2022-01-10T08:20:13 4 departed Zásilka byla odeslána na pobočku Alzabox Prachatice, Krumlovská 1103 (Kaufland) 13854 15322 2022-01-10T10:43:00 5 ready for pickup Zásilka byla přijata na cílovém výdejním místě Alzabox Prachatice, Krumlovská 1103 (Kaufland). 15322 0 2022-01-10T15:34:06 7 delivered Zásilka byla vydána. 15322 0 ``` ``` -------------------------------- ### Widget Implementation for Carrier PUDOs Source: https://github.com/packeta/api-documentation/blob/master/docs/pudo-delivery/examples/carriers-pudos.mdx This example demonstrates how to implement the Packeta Widget to specifically display carrier PUDOs on a website. It utilizes an iframe to embed a pre-configured CodePen example. ```HTML ``` -------------------------------- ### Create Packet Claim with Password (REST Example) Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-creation/claim-assistant.mdx This example shows the XML request and response for creating a packet claim with a password using REST. It includes fields for API password, claim details, and expected response elements like ID, barcode, and password. ```xml {{apiPassword}} claimNumber example@packetatest.com +420777777777 100.00 CZK MyEshop CZ false ok 1234567890 Z1234567890 Z 123 4567 890 P186A9 ``` -------------------------------- ### XML Packet Import Example Source: https://github.com/packeta/api-documentation/blob/master/docs/getting-started/client-section-imports.mdx This XML example demonstrates the structure for uploading packet data, including options for address delivery and customs declarations. Ensure your file conforms to the specified XML schema definition. ```xml 123abc my-eshop John Doe example@packetatest.com 666555666 CZK 132.00 100.00 1.5 13 Yellow street 12 Sun city 10101 1 a1a2a3a4a5a6a7a8,1b2b3b4b5b6b7b8b 246def my-eshop John Doe example@packetatest.com 555666555 CZK 264.00 1 3.5 Note 3294 Rocky street 2244 Swiss city 50505 Base64 encoded file content Base64 encoded file content ... ... ``` -------------------------------- ### packetTracking() Request/Response Example Source: https://github.com/packeta/api-documentation/blob/master/docs/packet_tracking/tracking.mdx Demonstrates the XML request format for the packetTracking method and a sample response containing detailed tracking records. ```APIDOC ## packetTracking() ### Description Retrieves detailed tracking information for a given packet ID. ### Method POST (implied by XML request structure) ### Endpoint Not explicitly defined, but assumed to be an API endpoint for packet tracking. ### Parameters #### Request Body - **packetTracking** (XML) - Required - The root element for the tracking request. - **apiPassword** (string) - Required - Your API password for authentication. - **packetId** (string) - Required - The unique identifier of the packet to track. ### Request Example ```xml {{apiPassword}} Z1234567890 ``` ### Response #### Success Response (200 OK) - **response** (XML) - Contains the tracking status and history. - **status** (string) - Indicates the success of the request ('ok' or 'error'). - **result** (XML) - Contains the tracking records if the status is 'ok'. - **record** (XML array) - A list of tracking events. - **dateTime** (string) - The timestamp of the tracking event. - **statusCode** (integer) - A code representing the status of the event. - **codeText** (string) - A short text description of the status code. - **statusText** (string) - A detailed text description of the status. - **branchId** (string) - The ID of the branch where the event occurred. - **destinationBranchId** (string) - The ID of the destination branch for this event. - **externalTrackingCode** (string) - External tracking code, if applicable. #### Response Example ```xml ok 2022-01-06T11:43:09 1 received data Internetový obchod předal informace o zásilce. 0 0 2022-01-07T12:44:43 2 arrived Zásilka byla přijata na pobočce Zásilkovna, Packeta office - pouze pro zaměstnance. 1038 0 ``` ``` -------------------------------- ### CSV Import Example Data Source: https://github.com/packeta/api-documentation/blob/master/docs/getting-started/client-section-imports.mdx This snippet shows example rows of data that can be used for CSV imports into the Packeta client section. It illustrates different field combinations and formats. ```csv "version 7" ,"20","John","Doe",,"packetatest@test","+420601234567","1200","CZK","1200.50","0.8",95,"my-eshop.com","0",,,,,,,,,, ,"201600002","John","Doe","ACME ltd.","john@doe.com","+420601234567","0","CZK","1500","1.2",3060,"my-eshop.com","0",,,,,,"AI0B5","100","100","100", ,"201600003","John","Doe",,"john@doe.com","+420601234567","0","CZK","400","0.4",250,"my-eshop.com","1",,,,,,,,,, ,"201100004","John","Doe","ACME ltd.","john@doe.com","+420601234567","32.21","EUR","32.21","1.5","16","my-second-eshop.com",,,"Street","123","City","12345","","150","200","250","Note" ,"201100005","John","Doe","ACME ltd.","john@doe.com","+420601234567","32.21","EUR","32.21","1.5","16","my-second-eshop.com",,,"Street","123","City","12345","","150","200","250","Note","1","a1a2a3a4a5a6a7a8,1b2b3b4b5b6b7b" ``` -------------------------------- ### Branch Opening Hours Example Source: https://github.com/packeta/api-documentation/blob/master/docs/pick-up-point-selection/branch-export-v5.mdx Defines regular, upcoming, and exceptional opening hours for a branch. Includes specific dates for exceptions. ```json { "regular": { "monday": "08:30-18:30", "tuesday": "08:30-18:30", "wednesday": "08:30-18:30", "thursday": "08:30-18:30", "friday": "08:30-18:30", "saturday": "08:30-14:00", "sunday": "" }, "upcoming": { "monday": "08:30-18:30", "tuesday": "08:30-18:30", "wednesday": "08:30-18:30", "thursday": "08:30-18:30", "friday": "08:30-18:30", "saturday": "08:30-14:00", "sunday": "08:30-14:00", "startDate": "2016-08-23" }, "exceptions": [ { "date": "2023-01-30", "hours": "08:00-12:00, 12:45-16:30" }, { "date": "2023-01-31", "hours": "08:00-12:00, 12:45-16:30" } ] } ``` -------------------------------- ### REST Packet Status Request Example Source: https://github.com/packeta/api-documentation/blob/master/docs/packet_tracking/tracking.mdx This example shows a simple XML structure for a REST request to get the status of a packet. It includes placeholders for the API password and packet ID. ```xml {{apiPassword}} Z1234567890 ok 2022-01-10T15:34:06 7 ``` -------------------------------- ### Branch Status Example Source: https://github.com/packeta/api-documentation/blob/master/docs/pick-up-point-selection/branch-export-v5.mdx Represents the status of a branch, including a status ID and a descriptive message. The language of the description can be controlled by the 'lang' GET parameter. ```json { "statusId": "1", "description": "In operation" } ``` -------------------------------- ### PHP Example for Creating a Storage File Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-creation/customs-declarations/storage-file.mdx This PHP snippet demonstrates how to use the SoapClient to create a storage file. It includes error handling for SOAP faults and requires the file content to be base64 encoded. ```php createStorageFile( $apiPassword, [ 'content' => base64_encode(file_get_contents('invoice_202101112.pdf')), 'name' => 'invoice_202101112.pdf', ] ); } catch(SoapFault $e) { var_dump($e->detail); // property detail contains error info } ?> ``` -------------------------------- ### Create Home Delivery Packet (C#) Source: https://github.com/packeta/api-documentation/blob/master/docs/packet-creation/home-delivery.mdx This C# example demonstrates creating a home delivery packet using the Packeta service client. It sets up the binding and endpoint address for the SOAP service. ```csharp using System; using System.ServiceModel; using System.Threading.Tasks; using PacketaService; namespace PacketaClientExample { class Program { static async Task Main(string[] args) { BasicHttpsBinding binding = new BasicHttpsBinding(); EndpointAddress endpointAddress = new EndpointAddress("https://www.zasilkovna.cz/api/soap"); const string apiPassword = "apiPassword"; PacketAttributes packetAttributes = new PacketAttributes { addressId = 106, name = "John", surname = "Doe", email = "example@packetatest.com", phone = "+420777777777", value = 500, weight = 1, eshop = "MyEshop", number = "orderNumber", street = "Českomoravská", ``` -------------------------------- ### Packet Status Request Example (REST) Source: https://github.com/packeta/api-documentation/blob/master/docs/packet_tracking/tracking.mdx This section provides an example of a REST request and response for checking packet status. ```APIDOC ## Packet Status Request (REST) ### Description Retrieves the current status of a packet. ### Method POST ### Endpoint https://www.zasilkovna.cz/api/rest ### Parameters #### Request Body - **packetStatus** (object) - Required - Contains the details for the status request. - **apiPassword** (string) - Required - The API password for authentication. - **packetId** (string) - Required - The ID of the packet to check the status for. ### Request Example ```xml {{apiPassword}} Z1234567890 ``` ### Response #### Success Response - **response** (object) - Contains the status information. - **status** (string) - Indicates if the request was successful ('ok'). - **result** (object) - Contains the tracking details. - **dateTime** (string) - The date and time of the last status update. - **statusCode** (integer) - The status code of the packet. #### Response Example ```xml ok 2022-01-10T15:34:06 7 ``` ``` -------------------------------- ### Initialize SOAP Client and API Password Source: https://github.com/packeta/api-documentation/blob/master/docs/api-reference/api-methods-reference.mdx This snippet shows how to initialize the SOAP client and define the API password, which are prerequisites for most API calls. ```php