#-> GLobal variables define('SPEEDY_API_USERNAME', 'xxxxxx'); define('SPEEDY_API_PASSWORD', 'yyyyyy'); define('SPEEDY_API_BASE_URL', 'https://api.speedy.bg/v1/'); define('LANGUAGE', 'EN'); #-> Function for api requests via cURL functions. In the examples we are using POST requests. function apiRequest($apiURL, $jsonData) { #-> Encode the array into JSON. $jsonDataEncoded = json_encode($jsonData); #-> Initiate cURL $curl = curl_init($apiURL); #-> Set curl options curl_setopt($curl, CURLOPT_POST, 1); // Tell cURL that we want to send a POST request. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // Verify the peer's SSL certificate. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Stop showing results on the screen. curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); // The number of seconds to wait while trying to connect. Use 0 to wait indefinitely. curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); // Set the content type to application/json curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonDataEncoded); // Attach our encoded JSON string to the POST fields. #-> Get the response $jsonResponse = curl_exec($curl); if ( $jsonResponse === FALSE) { exit("cURL Error: ".curl_error($curl)); } return($jsonResponse); }
PHP example: | The same example as JSON: |
#-> Example 1a. A shipment to an address. #-> I. SENDER $senderArray = array( 'phone1' => array('number' => '0888112233'), 'contactName' => 'IVAN PETROV', 'email' => '[email protected]', /* 'clientId' => 1234567890 */ // Not required ); /* * If you have a warehouse in Sofia, a shop in Varna and an office in Plovdiv, you'll have three objects with different clientIds, one for each object. * When you want to send from one of these addresses of your objects, you can set the appropriate 'clientId'. * If you skip it, the sender will be the default one for the username with all the address and contact information. * All your 'clientId's can be obtained from the result of the Get Contract Clients Request. */ #-> For drop off shipment (The 'dropoffOfficeId' property overrides the address details) //$senderArray['dropoffOfficeId'] = 2; // The 'dropoffOfficeId' can be obtained from the result of a Find Office Request. #-> II. RECIPIENT $recipientArray = array( 'phone1' => array('number' => '0899445566'), 'privatePerson' => true, 'clientName' => 'VASIL GEORGIEV', 'email' => '[email protected]' ); #-> If the shipment is to an address. There are several options to define an address. Check the examples below. $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteId' => 68134, // SOFIA. The 'siteId' can be obtained from the result of a Find Site Request. 'complexId' => 29, // A complex named 'KRASNA POLYANA 3'. The 'complexId' can be obtained from the result of a Find Complex Request. 'streetId' => 3109, // A street named 'USTA GENCHO'. The 'streetId' can be obtained from the result of a Find Street Request. 'streetNo' => '1A', 'blockNo' => '301', 'entranceNo' => '2', 'floorNo' => '3', 'apartmentNo' => '4' ); $recipientArray['address'] = $recipientAddressArray; #-> III. SERVICE DETAILS $serviceArray = array( 'pickupDate' => date('Y-m-d'), // Not mandatory (default value is today) 'autoAdjustPickupDate' => true, // Not mandatory 'serviceId' => 505, // The 'serviceId' can be obtained from the result of a Destination Services Request. 'saturdayDelivery' => true // Not mandatory. Use it if you want delivery on Saturday/Holiday. ); /* Cash on delivery - Not mandatory */ $cashOnDeliveryArray = array( 'amount' => 100, 'processingType' => 'CASH' // (CASH, POSTAL_MONEY_TRANSFER) ); /* Options before payment - Not mandatory */ $optionsBeforePaymentArray = array( 'option' => 'OPEN', 'returnShipmentServiceId' => 505, 'returnShipmentPayer' => 'SENDER' // (SENDER, RECIPIENT, THIRD_PARTY). The sender of the returning shipment is the recipient of the primary shipment. ); /* * 'returnShipmentServiceId' is the service for the returning shipment in case the recipient refuses to accept the primary shipment. * It can be the same serviceId as in the primary shipment or one obtained from the result of a Destination Services Request. */ /* Declared value - Not mandatory */ $declaredValueArray = array( 'amount' => 100, 'fragile' => true ); /* Additional services */ $additionalServicesArray = array( 'cod' => $cashOnDeliveryArray, 'obpd' => $optionsBeforePaymentArray, 'declaredValue' => $declaredValueArray ); /* Add additional services to the main service array */ $serviceArray['additionalServices'] = $additionalServicesArray; #-> IV. CONTENT OF THE PARCEL $contentArray = array( 'parcelsCount' => 1, 'contents' => 'MOBILE PHONE', 'package' => 'BOX', 'totalWeight' => 0.6 ); #-> V. PAYMENTS $paymentArray = array( 'courierServicePayer' => 'RECIPIENT', // (SENDER, RECIPIENT, THIRD_PARTY) 'declaredValuePayer' => 'RECIPIENT' // Mandatory only if the shipment has a 'declaredValue'. ); #-> VI. JSON DATA $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'sender' => $senderArray, // You can skip the sender data. In this case the sender will be the default one for the username with all the address and contact information. 'recipient' => $recipientArray, 'service' => $serviceArray, 'content' => $contentArray, 'payment' => $paymentArray, 'ref1' => 'ORDER 123456' ); #-> Create Shipment Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'shipment/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
A shipment to an address: |
#-> Example 1b. A shipment to an office. #-> I. SENDER $senderArray = array( 'phone1' => array('number' => '0888112233'), 'contactName' => 'IVAN PETROV', 'email' => '[email protected]', /* 'clientId' => 1234567890 */ // Not required ); /* * If you have a warehouse in Sofia, a shop in Varna and an office in Plovdiv, you'll have three objects with different clientIds, one for each object. * When you want to send from one of these addresses of your objects, you can set the appropriate 'clientId'. * If you skip it, the sender will be the default one for the username with all the address and contact information. * All your 'clientId's can be obtained from the result of the Get Contract Clients Request. */ #-> For drop off shipment (The 'dropoffOfficeId' property overrides the address details) //$senderArray['dropoffOfficeId'] = 2; // The 'dropoffOfficeId' can be obtained from the result of a Find Office Request. #-> II. RECIPIENT $recipientArray = array( 'phone1' => array('number' => '0899445566'), 'privatePerson' => true, 'clientName' => 'VASIL GEORGIEV', 'email' => '[email protected]' // For self collection shipment from office (use it instead of $recipientArray['address']) 'pickupOfficeId' => 14' // The 'pickupOfficeId' can be obtained from the result of a Find Office Request. ); #-> III. SERVICE DETAILS $serviceArray = array( 'pickupDate' => date('Y-m-d'), // Not mandatory (default value is today) 'autoAdjustPickupDate' => true, // Not mandatory 'serviceId' => 505, // The 'serviceId' can be obtained from the result of a Destination Services Request. 'saturdayDelivery' => true // Not mandatory. Use it if you want delivery on Saturday/Holiday. ); /* Cash on delivery - Not mandatory */ $cashOnDeliveryArray = array( 'amount' => 100, 'processingType' => 'CASH' // (CASH, POSTAL_MONEY_TRANSFER) ); /* Options before payment - Not mandatory */ $optionsBeforePaymentArray = array( 'option' => 'OPEN', 'returnShipmentServiceId' => 505, 'returnShipmentPayer' => 'SENDER' // (SENDER, RECIPIENT, THIRD_PARTY). The sender of the returning shipment is the recipient of the primary shipment. ); /* * 'returnShipmentServiceId' is the service for the returning shipment in case the recipient refuses to accept the primary shipment. * It can be the same serviceId as in the primary shipment or one obtained from the result of a Destination Services Request. */ /* Declared value - Not mandatory */ $declaredValueArray = array( 'amount' => 100, 'fragile' => true ); /* Additional services */ $additionalServicesArray = array( 'cod' => $cashOnDeliveryArray, 'obpd' => $optionsBeforePaymentArray, 'declaredValue' => $declaredValueArray ); /* Add additional services to the main service array */ $serviceArray['additionalServices'] = $additionalServicesArray; #-> IV. CONTENT OF THE PARCEL $contentArray = array( 'parcelsCount' => 1, 'contents' => 'MOBILE PHONE', 'package' => 'BOX', 'totalWeight' => 0.6 ); #-> V. PAYMENTS $paymentArray = array( 'courierServicePayer' => 'RECIPIENT', // (SENDER, RECIPIENT, THIRD_PARTY) 'declaredValuePayer' => 'RECIPIENT' // Mandatory only if the shipment has a 'declaredValue'. ); #-> VI. JSON DATA $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'sender' => $senderArray, // You can skip the sender data. In this case the sender will be the default one for the username with all the address and contact information. 'recipient' => $recipientArray, 'service' => $serviceArray, 'content' => $contentArray, 'payment' => $paymentArray, 'ref1' => 'ORDER 123456' ); #-> Create Shipment Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'shipment/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
A shipment to an office: |
#-> Example 1c. A shipment from an office and Third Party Payer. #-> I. SENDER $senderArray = array( 'phone1' => array('number' => '0888112233'), 'privatePerson' => false, 'clientName' => 'Company LTD', 'contactName' => 'IVAN PETROV', 'email' => '[email protected]', /* 'clientId' => 1234567890 */ // Not required 'dropoffOfficeId' => 2 // The 'dropoffOfficeId' can be obtained from the result of a Find Office Request. ); /* * If you have a warehouse in Sofia, a shop in Varna and an office in Plovdiv, you'll have three objects with different clientIds, one for each object. * When you want to send from one of these addresses of your objects, you can set the appropriate 'clientId'. * If you skip it, the sender will be the default one for the username with all the address and contact information. * All your 'clientId's can be obtained from the result of the Get Contract Clients Request. */ #-> II. RECIPIENT $recipientArray = array( 'phone1' => array('number' => '0899445566'), 'privatePerson' => true, 'clientName' => 'VASIL GEORGIEV', 'email' => '[email protected]' ); #-> If the shipment is to an address. There are several options to define an address. Check the examples below. $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteId' => 68134, // SOFIA. The 'siteId' can be obtained from the result of a Find Site Request. 'complexId' => 29, // A complex named 'KRASNA POLYANA 3'. The 'complexId' can be obtained from the result of a Find Complex Request. 'streetId' => 3109, // A street named 'USTA GENCHO'. The 'streetId' can be obtained from the result of a Find Street Request. 'streetNo' => '1A', 'blockNo' => '301', 'entranceNo' => '2', 'floorNo' => '3', 'apartmentNo' => '4' ); $recipientArray['address'] = $recipientAddressArray; #-> III. SERVICE DETAILS $serviceArray = array( 'pickupDate' => date('Y-m-d'), // Not mandatory (default value is today) 'autoAdjustPickupDate' => true, // Not mandatory 'serviceId' => 505, // The 'serviceId' can be obtained from the result of a Destination Services Request. 'saturdayDelivery' => true // Not mandatory. Use it if you want delivery on Saturday/Holiday. ); /* Cash on delivery - Not mandatory */ $cashOnDeliveryArray = array( 'amount' => 100, 'processingType' => 'CASH' // (CASH, POSTAL_MONEY_TRANSFER) ); /* Options before payment - Not mandatory */ $optionsBeforePaymentArray = array( 'option' => 'OPEN', 'returnShipmentServiceId' => 505, 'returnShipmentPayer' => 'THIRD_PARTY' // (SENDER, RECIPIENT, THIRD_PARTY). The sender of the returning shipment is the recipient of the primary shipment. ); /* * 'returnShipmentServiceId' is the service for the returning shipment in case the recipient refuses to accept the primary shipment. * It can be the same serviceId as in the primary shipment or one obtained from the result of a Destination Services Request. */ /* Declared value - Not mandatory */ $declaredValueArray = array( 'amount' => 100, 'fragile' => true ); /* Additional services */ $additionalServicesArray = array( 'cod' => $cashOnDeliveryArray, 'obpd' => $optionsBeforePaymentArray, 'declaredValue' => $declaredValueArray ); /* Add additional services to the main service array */ $serviceArray['additionalServices'] = $additionalServicesArray; #-> IV. CONTENT OF THE PARCEL $contentArray = array( 'parcelsCount' => 1, 'contents' => 'MOBILE PHONE', 'package' => 'BOX', 'totalWeight' => 0.6 ); #-> V. PAYMENTS $paymentArray = array( 'courierServicePayer' => 'THIRD_PARTY', // (SENDER, RECIPIENT, THIRD_PARTY) 'declaredValuePayer' => 'THIRD_PARTY', // Mandatory only if the shipment has a 'declaredValue'., 'thirdPartyClientId' => 1234567890 // All your 'clientId's can be obtained from the result of the Get Contract Clients Request. ); #-> VI. JSON DATA $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'sender' => $senderArray, // You can skip the sender data. In this case the sender will be the default one for the username with all the address and contact information. 'recipient' => $recipientArray, 'service' => $serviceArray, 'content' => $contentArray, 'payment' => $paymentArray, 'ref1' => 'ORDER 123456' ); #-> Create Shipment Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'shipment/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
A shipment from an office and Third Party Payer: |
PHP example: | The same example as JSON: |
#-> Example 1. Print a waybill (with one parcel).
$parcelsArray = array( array('parcel' => array('id' => '1234567890')), ); #-> The JSON data. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'paperSize' => 'A4', // A4, A6, A4_4xA6 'parcels' => $parcelsArray ); $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'print/', $jsonData); header("Content-type: application/octet-stream"); header("Content-Type: application/pdf"); echo $jsonResponse; |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "paperSize" : "A4", "parcels" : [ { "parcel" : { "id" : "1234567890" } } ], "additionalWaybillSenderCopy" : "NONE" } |
#-> Example 2. Print a waybill created with more than one parcel.
$parcelsArray = array( array('parcel' => array('id' => '1234567890')), // The first parcel is always the waybill number array('parcel' => array('id' => '123456789024')), // Second parcel of the 1234567890 waybill (it is a unique number returned by the Create Shipment Request) array('parcel' => array('id' => '123456789030')), // Third parcel of the 1234567890 waybill (it is a unique number) ); #-> The JSON data. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'paperSize' => 'A4', // A4, A6, A4_4xA6 'parcels' => $parcelsArray ); $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'print/', $jsonData); header("Content-type: application/octet-stream"); header("Content-Type: application/pdf"); echo $jsonResponse; |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "paperSize" : "A4", "parcels" : [ { "parcel" : { "id" : "1234567890" } }, { "parcel" : { "id" : "123456789024" } }, { "parcel" : { "id" : "123456789030" } } ], "additionalWaybillSenderCopy" : "NONE" } |
PHP example: | The same example as JSON: |
#-> JSON DATA $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE ); #-> Get Contract Clients Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'client/contract/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN" } |
PHP example: | The same example as JSON: |
#-> Example 1. Search by full country name. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'name' => 'ROMANIA' ); /* * The result from the example will return all data for ROMANIA such as id, isoAlpha2, isoAlpha3, currencyCode, postCodeFormats, requireState etc. * If the result for a country has a property named 'currencyCode' and selected service allows it, you can use Cash On Delivery in your parcels for this country. */ #-> Find Country Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/country/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "name" : "ROMANIA" } |
#-> Example 2. Search by part of the country name. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'name' => 'GER' // The 'name' is partial ); /* The result from the example will return all countries which contain 'GER' in their names: GERMANY, ALGERIA, NIGER, NIGERIA. */ #-> Find Country Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/country/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "name" : "GER" } |
#-> Example 3. Search by country isoAlpha2. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'isoAlpha2' => 'GR' ); /* The result from the example will return all data for GREECE. The 'isoAlpha2' and 'isoAlpha3' are unique. */ #-> Find Country Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/country/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "isoAlpha2" : "GR" } |
PHP example: | The same example as JSON: |
#-> Example 1. Search by full state name. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'countryId' => 840, // USA 'name' => 'ALABAMA' ); /* * The result from the example will return all data for ALABAMA including its id. */ #-> Find Country Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/state/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "countryId" : 840, "name" : "ALABAMA" } |
#-> Example 2a. Search by part of state name. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'countryId' => 840, // USA 'name' => 'AR' ); /* The result from the example will return data for states in USA, * witch contain 'AR' in their names: 'ARKANSAS' and 'ARIZONA'. You will have to select one of the records. */ #-> Find Country Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/state/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "countryId" : 840, "name" : "AR" } |
#-> Example 2b. Search by part of state name. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'countryId' => 124, // CANADA 'name' => 'N' ); /* The result from the example will return data for states in CANADA, * witch contain 'AR' in their names: 'NEW BRUNSWICK', 'NEWFOUNDLAND AND LABRADOR', 'NOVA SCOTIA', etc. You will have to select one of the records. */ #-> Find Country Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/state/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "countryId" : 124, "name" : "N" } |
PHP example: | The same example as JSON: |
#-> Example 1. Find offices in a country. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'countryId' => 100, // BULGARIA ); /* The result from the example will return all offices in BULGARIA. * To find offices in ROMANIA use 642 instead of 100 for countryId. For GREECE use 300. */ #-> Find Office Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/office/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "countryId" : 100 } |
#-> Example 2. Find offices in a site. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'siteId' => 68134, // SOFIA ); /* The result from the example will return all offices in SOFIA. */ #-> Find Office Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/office/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "siteId" : 68134 } |
#-> Example 3. Find office by country and part of the name. The 'countryId' is not mandatory. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'countryId' => 100, // BULGARIA 'name' => 'SOM' // The name can be partial ); /* The result from the example will return all offices in BULGARIA which names contain 'SOM'. */ #-> Find Office Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/office/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "countryId" : 100, "name" : "SOM" } |
#-> Example 4. Find office in a site by part of the name. The 'siteId' is not mandatory. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'siteId' => 68134, // SOFIA 'name' => 'SOM' // The name can be partial ); /* The result from the example will return all offices in SOFIA which names contain 'SOM'. */ #-> Find Office Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/office/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "siteId" : 68134, "name" : "SOM" } |
PHP example: | The same example as JSON: |
#-> Example 1. Search by part of the site name. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'countryId' => 100, // BULGARIA 'name' => 'DOBR' ); /* The result from the example will return data (such as id, type, post code) for all sites in BULGARIA, * witch contain 'DOBR' in their names: 'DOBRINISHTE', 'DOBRICH', 'DOBRA POLYANA' etc. */ #-> Find site Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/site/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "countryId" : 100, "name" : "DOBR" } |
#-> Example 2. Search by exact site name. The site names in BULGARIA are not unique. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'countryId' => 100, // BULGARIA 'name' => 'DOBRICH' ); /* The result from the example will return 3 sites in BULGARIA but with 3 different types, post codes, regions, coordinates etc. * You will have to select one of the records or add another filter for more precise result. */ #-> Find site Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/site/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "countryId" : 100, "name" : "DOBRICH" } |
#-> Example 3. Search site by name and post code. The combination from the name and post code is unique. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'countryId' => 100, // BULGARIA 'name' => 'DOBRICH', // The name can be partial 'postCode' => 9300 ); /* The result from the example will be an exact match for the search criteria and will return only one site. */ #-> Find site Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/site/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "countryId" : 100, "name" : "DOBRICH", "postCode" : 9300 } |
#-> Example 4. Search by site post code. The post codes in BULGARIA are not unique. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'countryId' => 100, // BULGARIA 'postCode' => 1475 ); /* The result from the example will return two sites with this post code: 'PLANA' and 'ZHELEZNITSA'. * You will have to select one of the records or add another filter for more precise result. */ #-> Find site Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/site/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "countryId" : 100, "postCode" : "1475" } |
#-> Example 5. Search by site name, type and region. The combination from these three elements is unique. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'countryId' => 100, // BULGARIA 'type' => 'gr.', 'name' => 'KOSTENETS', // The name can be partial 'region' => 'SOFIA' // The region can be partial ); /* The result from the example will be an exact match for the search criteria and will return only one site. */ #-> Find site Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/site/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "countryId" : 100, "type" : "gr.", "name" : "KOSTENETS", "region" : "SOFIA" } |
PHP example: | The same example as JSON: |
#-> Example 1. Search by part of the complex name. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'siteId' => 68134, // SOFIA 'name' => 'KRASN' ); /* The result from the example will return data such as id, type, name for all complexes in SOFIA, * witch contain 'KRASN' in their names: 'KRASNA POLYANA 1', 'KRASNA POLYANA 2', 'KRASNO SELO' etc. */ #-> Find Complex Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/complex/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "siteId" : 68134, "name" : "KRASN" } |
PHP example: | The same example as JSON: |
#-> Example 1. Search street details by part of the name. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'siteId' => 68134, // SOFIA 'name' => 'USTA' ); /* The result from the example will return data (such as id, type and name) for all streets in SOFIA, * witch contain 'USTA' in their names: 'USTA GENCHO', 'TSANKO DYUSTABANOV'. You will have to select one of the records. */ #-> Find Street Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/street/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "siteId" : 68134, "name" : "USTA" } |
#-> Example 2. Search street details by full street name. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'siteId' => 68134, // SOFIA 'name' => 'VASIL LEVSKI' ); /* The result from the example will return 3 streets in SOFIA named 'VASIL LEVSKI', * but with 3 different types: 'bul.', 'ul.' and 'pl.', and you will have to select one of the records. */ #-> Find Street Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/street/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "siteId" : 68134, "name" : "VASIL LEVSKI" } |
#-> Example 3. Search street details by full name and type. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'siteId' => 68134, // SOFIA 'name' => 'VASIL LEVSKI', 'type' => 'bul.' ); /* The result from the example will be an exact match for the search criteria and will return only one street. */ #-> Find Street Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/street/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "siteId" : 68134, "name" : "VASIL LEVSKI", "type" : "bul." } |
PHP example: | The same example as JSON: |
#-> Example 1. Search poi details by part of the name. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'siteId' => 68134, // SOFIA, BULGARIA 'name' => 'NATIONAL' // The name can be partial ); /* The result from the example will return data (such as id, type and name) for POIs in SOFIA, * witch contain 'NATIONAL' in their names: 'NATIONAL ART GALLERY', 'NATIONAL PALACE OF CHILDREN', 'NATIONAL MUSEUM OF HISTORY', etc. You will have to select one of the records. */ #-> Find Street Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'location/poi/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "siteId" : 68134, "name" : "NATIONAL" } |
PHP example: | The same example as JSON: |
#-> Example 1. The sender has clientId, the recipient is a private person. #-> SENDER $senderArray = array( 'clientId' => 1234567890 ); /* * If you have a warehouse in Sofia, a shop in Varna and an office in Plovdiv, you'll have three objects with different clientIds, one for each object. * When you want to send from one of these addresses of your objects, you can set the appropriate 'clientId'. * If you skip it, the sender will be the default one for the username with all the address and contact information. * All your 'clientId's can be obtained from the result of the Get Contract Clients Request. */ #-> RECIPIENT $recipientArray = array( 'privatePerson' => true, 'addressLocation' => array( 'siteId' => 68134 // SOFIA ) ); /* There is no need to define full address. The price of the courier service is the same for different addresses in a site. */ #-> JSON DATA $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'date' => date('Y-m-d'), 'sender' => $senderArray, // You can skip the sender data. In this case the sender will be the default one for the username with all the address and contact information. 'recipient' => $recipientArray ); #-> Destination Services Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'services/destination', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "date" : "2021-05-31", "sender" : { "clientId" : 1234567890 }, "recipient" : { "privatePerson" : true, "addressLocation" : { "siteId" : 68134 } } } |
#-> Example 2. The sender has clientId, the recipient is a private person in another country. #-> SENDER $senderArray = array( 'clientId' => 1234567890 ); /* * If you have a warehouse in Sofia, a shop in Varna and an office in Plovdiv, you'll have three objects with different clientIds, one for each object. * When you want to send from one of these addresses of your objects, you can set the appropriate 'clientId'. * If you skip it, the sender will be the default one for the username with all the address and contact information. * All your 'clientId's can be obtained from the result of the Get Contract Clients Request. */ #-> RECIPIENT $recipientArray = array( 'privatePerson' => true, 'addressLocation' => array( 'countryId' => 300, // GREECE 'postCode' => 54248 // Thessaloniki ) ); #-> JSON DATA $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'date' => date('Y-m-d'), 'sender' => $senderArray, 'recipient' => $recipientArray ); #-> Destination Services Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'services/destination', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "date" : "2021-05-31", "sender" : { "clientId" : 1234567890 }, "recipient" : { "privatePerson" : true, "addressLocation" : { "countryId" : 300, "postCode" : "54248" } } } |
PHP example: | The same example as JSON: |
#-> IA. SENDER (from an address) $senderArray = array( 'clientId' => 1234567890 ); /* * If you have a warehouse in Sofia, a shop in Varna and an office in Plovdiv, you'll have three objects with different clientIds, one for each object. * When you want to send from one of these addresses of your objects, you can set the appropriate 'clientId'. * If you skip it, the sender will be the default one for the username with all the address and contact information. * All your 'clientId's can be obtained from the result of the Get Contract Clients Request. */ #-> IB. SENDER (from an office) $senderArray = array( 'clientId' => 1234567890, 'dropoffOfficeId' => 2 // The 'dropoffOfficeId' property overrides the address details ); #-> IIA. RECIPIENT (to an address) $recipientArray = array( 'privatePerson' => true, 'addressLocation' => array( 'siteId' => 10135 // VARNA. The 'siteId' can be obtained from the result of a Find Site Request. ) ); #-> IIB. RECIPIENT (for self collection shipment from office) $recipientArray = array( 'privatePerson' => true, 'pickupOfficeId' => 77 // VARNA - OFFICE. The 'pickupOfficeId' can be obtained from the result of a Find Office Request. ); #-> III. SERVICE DETAILS $serviceArray = array( 'autoAdjustPickupDate' => true, 'serviceIds' => array(505) // The 'serviceId' list can be obtained from the result of a Destination Services Request. ); #-> Additional services /* Cash on delivery - Not mandatory */ $cashOnDeliveryArray = array( 'amount' => 100, 'processingType' => 'CASH' // (CASH, POSTAL_MONEY_TRANSFER) ); /* Options before payment - Not mandatory */ $optionsBeforePaymentArray = array( 'option' => 'OPEN', 'returnShipmentServiceId' => 505, 'returnShipmentPayer' => 'SENDER' // (SENDER, RECIPIENT, THIRD_PARTY). The sender of the returning shipment is the recipient of the primary shipment. ); /* The 'returnShipmentServiceId' property is the service for the returning shipment in case the recipient refuses to accept the primary shipment. It can be the same serviceId as in the primary shipment or one obtained from the result of a Destination Services Request. */ /* Declared value - Not mandatory */ $declaredValueArray = array( 'amount' => 100, 'fragile' => true ); /* Additional services */ $additionalServicesArray = array( 'cod' => $cashOnDeliveryArray, 'obpd' => $optionsBeforePaymentArray, 'declaredValue' => $declaredValueArray ); /* Add additional services to the main service array */ $serviceArray['additionalServices'] = $additionalServicesArray; #-> IV. CALCULATION CONTENT OF THE PARCEL $contentArray = array( 'parcelsCount' => 1, 'totalWeight' => 0.6 ); #-> V. PAYMENTS $paymentArray = array( 'courierServicePayer' => 'RECIPIENT' // (SENDER, RECIPIENT, THIRD_PARTY) ); #-> VI. JSON DATA. $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'sender' => $senderArray, // You can skip the sender data. In this case the sender will be the default one for the username with all the address and contact information. 'recipient' => $recipientArray, 'service' => $serviceArray, 'content' => $contentArray, 'payment' => $paymentArray ); #-> Calculate Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'calculate/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
A calculation to an address { "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "sender" : { "clientId" : 1234567890 }, "recipient" : { "privatePerson" : true, "addressLocation" : { "siteId" : 10135 } }, "service" : { "autoAdjustPickupDate" : true, "serviceIds" : [ 505 ], "additionalServices" : { "cod" : { "amount" : 100.0, "processingType" : "CASH" }, "declaredValue" : { "amount" : 100.0, "fragile" : true, "ignoreIfNotApplicable" : true }, "obpd" : { "option" : "OPEN", "returnShipmentServiceId" : 505, "returnShipmentPayer" : "SENDER" } } }, "content" : { "parcelsCount" : 1, "totalWeight" : 0.6 }, "payment" : { "courierServicePayer" : "RECIPIENT" } } A calculation to an office { "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "sender" : { "clientId" : 1234567890 }, "recipient" : { "privatePerson" : true, "pickupOfficeId" : 77 }, "service" : { "autoAdjustPickupDate" : true, "serviceIds" : [ 505 ], "additionalServices" : { "cod" : { "amount" : 100.0, "processingType" : "CASH" }, "declaredValue" : { "amount" : 100.0, "fragile" : true, "ignoreIfNotApplicable" : true }, "obpd" : { "option" : "OPEN", "returnShipmentServiceId" : 505, "returnShipmentPayer" : "SENDER" } } }, "content" : { "parcelsCount" : 1, "totalWeight" : 0.6 }, "payment" : { "courierServicePayer" : "RECIPIENT" } } |
PHP example: | The same example as JSON: |
#-> Example 1. Track a parcel. $parcelsArray = array( array('id' => 299999990) ); $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'parcels' => $parcelsArray ); #-> Track parcel Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'track/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "parcels" : [ { "id" : "299999990" } ] } |
#-> Example 2. Track a parcel and return only last operation. $parcelsArray = array( array('id' => 299999990) ); $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'parcels' => $parcelsArray, 'lastOperationOnly' => true ); #-> Track parcel Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'track/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "parcels" : [ { "id" : "299999990" } ], "lastOperationOnly" : true } |
#-> Example 3. Track more than one parcels with one request. $parcelsArray = array( array('id' => 299999990), array('id' => 299999991), array('id' => 299999992), array('id' => 299999993) ); $jsonData = array( 'userName' => SPEEDY_API_USERNAME, 'password' => SPEEDY_API_PASSWORD, 'language' => LANGUAGE, 'parcels' => $parcelsArray ); #-> Track parcel Request $jsonResponse = apiRequest(SPEEDY_API_BASE_URL.'track/', $jsonData); $jsonResponse = json_decode($jsonResponse, true); #-> Print the result print_r($jsonResponse); |
{ "userName" : "xxxxxx", "password" : "yyyyyy", "language" : "EN", "parcels" : [ { "id" : "299999990" }, { "id" : "299999991" }, { "id" : "299999992" }, { "id" : "299999993" } ] } |
When address is required (i.e. when clientId is null), the following rule must be met:
not empty street (streetId or type&name) and (streetNo or blockNo)
or
not empty complex (complexId or type&name) and (streetNo or blockNo)
or
not empty poi (poiId)
or
all components of the address within the site stored in addressNote.
If the addressType is 1 and 'addressNomenclature' property for the site is 1 or 2, you should try to define the address using ids of site, street, complex etc.
or by exact match from 'complexType' and 'complexName' or/and by exact match from 'streetType' and 'streetName'.
When the address is well defined via ids or/and matches it will be processed automatically.
Otherwise the address will be placed in the 'addressNote' property. It will not be processed automatically and there are probabilities for mistakes and delay of the delivery.
PHP example: | The same example as JSON: |
#-> Example 1. Defined address via ids (the 'addressType' property has a value 1 and 'addressNomenclature' property of the site has value 1 or 2). $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteId' => 68134, // SOFIA. The 'siteId' can be obtained from the result of a Find Site Request. 'complexId' => 29, // A complex named 'KRASNA POLYANA 3'. The 'complexId' can be obtained from the result of a Find Complex Request. 'streetId' => 3109, // A street named 'USTA GENCHO'. The 'streetId' can be obtained from the result of a Find Street Request. 'streetNo' => '1A', 'blockNo' => '301', 'entranceNo' => '2', 'floorNo' => '3', 'apartmentNo' => '4' ); |
"address" : { "countryId" : 100, "siteId" : 68134, "streetId" : 3109, "streetNo" : "1A", "complexId" : 29, "blockNo" : "301", "entranceNo" : "2", "floorNo" : "3", "apartmentNo" : "4" } |
#-> Example 2a. An address defined by exact match from 'siteType' and 'siteName', and exact match from 'streetType' and 'streetName' #-> (the 'addressType' property has a value 1 and 'addressNomenclature' property of the site has value 1 or 2). $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteType' => 'gr.', // The 'siteType' can be obtained from the result of a Find Country Request. 'siteName' => 'SOFIA', 'streetType' => 'ul.', // The 'streetType' can be obtained from the result of a Find Country Request. 'streetName' => 'USTA GENCHO', // The 'streetName' can be obtained from the result of a Find Street Request. 'streetNo' => '1A' ); /* * If there is exact match from 'siteType' and 'siteName', the id of the site will be added automatically. * If there is exact match from 'streetType' and 'streetName', the id of the street will be added automatically. * If there is not exact match from 'streetType' and 'streetName' the address will be placed in the 'addressNote' property. */ |
"address" : { "countryId" : 100, "siteType" : "gr.", "siteName" : "SOFIA", "streetType" : "ul.", "streetName" : "USTA GENCHO", "streetNo" : "1A" } |
#-> Example 2b. An address defined by exact match from 'siteType' and 'postCode', and exact match from 'streetType' and 'streetName' #-> (the 'addressType' property has a value 1 and 'addressNomenclature' property of the site has value 1 or 2). $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteName' => 'SOFIA', 'postCode' => '1330', 'streetType' => 'ul.', // The 'streetType' can be obtained from the result of a Find Country Request. 'streetName' => 'USTA GENCHO', // The 'streetName' can be obtained from the result of a Find Street Request. 'streetNo' => '1A' ); /* * If there is exact match from 'siteType' and 'postCode', the id of the site will be added automatically. * If there is exact match from 'streetType' and 'streetName', the id of the street will be added automatically. * If there is not exact match from 'streetType' and 'streetName' the address will be placed in the 'addressNote' property. */ |
"address" : { "countryId" : 100, "siteName" : "SOFIA", "postCode" : "1331", "streetType" : "ul.", "streetName" : "USTA GENCHO", "streetNo" : "1A" } |
#-> Example 3. An address defined by ids of the site and the complex, and an exact match between 'streetType' and 'streetName' #-> (the 'addressType' property has a value 1 and 'addressNomenclature' property of the site has value 1 or 2). $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteId' => 68134, // SOFIA. The 'siteId' can be obtained from the result of a Find Site Request. 'complexId' => 29, // A complex named 'KRASNA POLYANA 3'. The 'complexId' can be obtained from the result of a Find Complex Request. 'streetType' => 'ul.', // The 'streetType' can be obtained from the result of a Find Country Request. 'streetName' => 'USTA GENCHO', // The 'streetName' can be obtained from the result of a Find Street Request. 'streetNo' => '1A' ); /* * If there is exact match from 'streetType' and 'streetName', the id of the street will be added automatically. * If there is not exact match from 'streetType' and 'streetName' the address will be placed in the 'addressNote' property. */ |
"address" : { "countryId" : 100, "siteId" : 68134, "complexId" : 29, "streetType" : "ul.", "streetName" : "USTA GENCHO", "streetNo" : "1A" } |
#-> Example 4a. An address defined by exact match from 'complexType' and 'complexName' or/and exact match from 'streetType' and 'streetName' #-> (the 'addressType' property has a value 1 and 'addressNomenclature' property of the site has value 1 or 2). $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteId' => 68134, // SOFIA. The 'siteId' can be obtained from the result of a Find Site Request. 'complexType' => 'zhk', // 'complexType' can be obtained from the result of a Find Country Request. 'complexName' => 'KRASNA POLYANA 3', // The 'complexName' can be obtained from the result of a Find Complex Request. 'streetType' => 'ul.', // The 'streetType' can be obtained from the result of a Find Country Request. 'streetName' => 'USTA GENCHO', // The 'streetName' can be obtained from the result of a Find Street Request. 'streetNo' => '1A' ); /* * If there is exact match from 'complexType' and 'complexName', the id of the complex will be added automatically. * If there is exact match from 'streetType' and 'streetName', the id of the street will be added automatically. * If there are not exact matches, the address will be placed in the 'addressNote' property. */ |
"address" : { "countryId" : 100, "siteId" : 68134, "complexType" : "zhk", "complexName" : "KRASNA POLYANA 3", "streetType" : "ul.", "streetName" : "USTA GENCHO", "streetNo" : "1A" } |
#-> Example 4b. An address defined by exact match from 'complexType' and 'complexName' #-> (the 'addressType' property has a value 1 and 'addressNomenclature' property of the site has value 1 or 2). $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteId' => 68134, // SOFIA. The 'siteId' can be obtained from the result of a Find Site Request. 'complexType' => 'zhk', // 'complexType' can be obtained from the result of a Find Country Request. 'complexName' => 'KRASNA POLYANA 3', // The 'complexName' can be obtained from the result of a Find Complex Request. 'blockNo' => '37', 'entranceNo' => '1', 'apartmentNo' => '2' ); /* * If there is exact match from 'complexType' and 'complexName', the id of the complex will be added automatically. * If there are not exact matches, the address will be placed in the 'addressNote' property. */ |
"address" : { "countryId" : 100, "siteId" : 68134, "complexType" : "zhk", "complexName" : "KRASNA POLYANA 3", "blockNo" : "37", "entranceNo" : "1", "apartmentNo" : "2" } |
#-> Example 5. An address defined by 'siteId' and exact match from 'streetType' and 'streetName'. $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteId' => 68134, // SOFIA. The 'siteId' can be obtained from the result of a Find Site Request. 'streetType' => 'ul.', // The 'streetType' can be obtained from the result of a Find Country Request. 'streetName' => 'USTA GENCHO', // The 'streetName' can be obtained from the result of a Find Street Request. 'streetNo' => '1A' ); /* * If there is exact match from 'streetType' and 'streetName', the id of the street will be added automatically. * If there is not exact match, the address will be placed in the 'addressNote' property. */ |
"address" : { "countryId" : 100, "siteId" : 68134, "streetType" : "ul.", "streetName" : "USTA GENCHO", "streetNo" : "1A" } |
#-> Example 6. The address defined by 'poiId' and some additional info filled in the 'addressNote'. $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteId' => 68134, // SOFIA. The 'siteId' can be obtained from the result of a Find Site Request. 'poiId' => 68134000483088, // NATIONAL ART GALLERY. The 'poiId' can be obtained from the result of a Find POI Request. 'addressNote' => '2nd floor, office 201' ); |
"address" : { "countryId" : 100, "siteId" : 68134, "poiId" : 68134000483088, "addressNote" : "2nd floor, office 201" } |
#-> Example 7a. The whole address is placed in the 'addressNote' field. #-> It will be not processed automatically and there are probabilities for mistakes and delay of the delivery. $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteId' => 68134, // SOFIA. The 'siteId' can be obtained from the result of a Find Site Request. 'addressNote' => 'ul. USTA GENCHO, No.1A, bl.301, ent.2, fl.3, ap.4' ); |
"address" : { "countryId" : 100, "siteId" : 68134, "addressNote" : "ul. USTA GENCHO, No.1A, bl.301, ent.2, fl.3, ap.4" } |
#-> Example 7b. The whole address is placed in the 'addressNote' field. #-> It will be not processed automatically and there are probabilities for mistakes and delay of the delivery. $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteType' => 'gr.', // The 'siteType' can be obtained from the result of a Find Country Request. 'siteName' => 'SOFIA', 'addressNote' => 'ul. USTA GENCHO, No.1A, bl.301, ent.2, fl.3, ap.4' ); /* If there is exact match from 'siteType' and 'siteName', the id of the site will be added automatically. */ |
"address" : { "countryId" : 100, "siteType" : "gr.", "siteName" : "SOFIA", "addressNote" : "ul. USTA GENCHO, No.1A, bl.301, ent.2, fl.3, ap.4" } |
#-> Example 7c. The whole address is placed in the 'addressNote' field. #-> It will be not processed automatically and there are probabilities for mistakes and delay of the delivery. $recipientAddressArray = array( 'countryId' => 100, // BULGARIA. The 'countryId' can be obtained from the result of a Find Country Request. 'siteName' => 'SOFIA', 'postCode' => 1330, 'addressNote' => 'ul. USTA GENCHO, No.1A, bl.301, ent.2, fl.3, ap.4' ); /* If there is exact match from 'siteName' asd 'postCode', the id of the site will be added automatically. */ |
"address" : { "countryId" : 100, "siteName" : "SOFIA", "postCode" : "1330", "addressNote" : "ul. USTA GENCHO, No.1A, bl.301, ent.2, fl.3, ap.4" } |
#-> Example 8a. A foreign address (the addressType property has a value 2). $recipientAddressArray = array( 'countryId' => 276, // GERMANY. The 'countryId' can be obtained from the result of a Find Country Request. 'siteName' => 'MUNICH', 'postCode' => 80331, // Depends from the 'postCodeFormats' property from the result of a Find Country Request. It shows the required post code format. 'addressLine1' => 'Sankt-Jakobs-Platz 1', // Required for 'addressType' 2 'addressLine2' => 'Munich Stadtmuseum' /* Not mandatory */ ); |
"address" : { "countryId" : 276, "siteName" : "MUNICH", "postCode" : "80331", "addressLine1" : "Sankt-Jakobs-Platz 1", "addressLine2" : "Munich Stadtmuseum" } |
#-> Example 8b. A foreign address (the addressType property has a value 2). $recipientAddressArray = array( 'countryId' => 300, // GREECE. The 'countryId' can be obtained from the result of a Find Country Request. 'siteName' => 'THESSALONIKI', 'postCode' => 54629, // Depends from the 'postCodeFormats' property from the result of a Find Country Request. It shows the required post code format. 'addressLine1' => '28 Monastiriou str', // Required for 'addressType' 2 'addressLine2' => 'Bus station' /* Not mandatory */ ); |
"address" : { "countryId" : 300, "siteName" : "THESSALONIKI", "postCode" : "54629", "addressLine1" : "28 Monastiriou str", "addressLine2" : "Bus station" } |
#-> Example 8c. A foreign address (the addressType property has a value 2). $recipientAddressArray = array( 'countryId' => 250, // FRANCE. The 'countryId' can be obtained from the result of a Find Country Request. 'siteName' => 'PARIS', 'postCode' => 75016, // Depends from the 'postCodeFormats' property from the result of a Find Country Request. It shows the required post code format. 'addressLine1' => '24 Rue du Commandant Guilbaud', // Required for 'addressType' 2 'addressLine2' => 'Parc des Princes Stadium' /* Not mandatory */ ); |
"address" : { "countryId" : 250, "siteName" : "PARIS", "postCode" : "75016", "addressLine1" : "24 Rue du Commandant Guilbaud", "addressLine2" : "Parc des Princes Stadium" } |
PHP example: | The same example as JSON: |
// Array for all parcels. All dimensions are in centimeteres. For pallets use standart pallet's dimensions such as 120/80/130. $parcelsArray = array(); // Parcel 1 $parcelSizeArray = array( 'width' => 10, 'depth' => 20, 'height' => 30 ); $parcelArray = array( 'seqNo' => 1, 'size' => $parcelSizeArray, 'weight' => 1.5, 'ref1' => 'ORDER 123456, 1st Box' ); $parcelsArray[] = $parcelArray; // Add first parcel // Parcel 2 $parcelSizeArray = array( 'width' => 5, 'depth' => 15, 'height' => 25 ); $parcelArray = array( 'seqNo' => 2, 'size' => $parcelSizeArray, 'weight' => 0.5, 'ref1' => 'ORDER 123456, 2nd Box' ); $parcelsArray[] = $parcelArray; // Add second parcel $contentArray['parcels'] = $parcelsArray; // Add all parcels in the content array in the Create Shipment Request above. |
"content" : { "parcels" : [ { "seqNo" : 1, "size" : { "width" : 10, "height" : 30, "depth" : 20 }, "weight" : 1.5, "ref1" : "ORDER 123456, 1st Box" }, { "seqNo" : 2, "size" : { "width" : 5, "height" : 25, "depth" : 15 }, "weight" : 0.5, "ref1" : "ORDER 123456, 2nd Box" } ] }, |
SOAP web method | REST API request |
---|---|
loginlogin |
There is no login method. You need to use username and password in every method. |
isSessionActiveReturns whether the session is active. |
It is not necessary in API. |
listServicesReturns the list of courier services valid on this date. |
Services RequestGet available services for date and destination |
listServicesForSitesReturns the list of courier services valid on this date and sites. |
Destination Services RequestGet available services for date and destination |
getWeightIntervalReturns the min/max weight allowed for the given shipment parameters. |
There is no such method in API. |
listSitesReturns a list of sites matching the search criteria. The method is deprecated. Use "listSitesEx" instead |
Find Site RequestGet all sites for a country in csv file. Country id is specified as path parameter |
listSitesExReturns a list of sites. The algorithm aims to find the closest matches. |
Find Site RequestGet all sites for a country in csv file. Country id is specified as path parameter |
getAddressNomenclature |
Get All Countries Request, Get All States Request, Get All Sites Request Get All Streets Request Get All Complexes Request Get All Blocks Request Get All Points of Interest Request |
getPickingDeliveryInfoThis method can be used to get delivery information of a shipment. If picking is not delivered "null" is returned |
Track Request |
listAllSitesReturns a list of all sites for country. In case no country is specified, the method defaults to sites in Bulgaria |
Get All Sites RequestGet all sites for a country in csv file. Country id is specified as path parameter |
getSiteByIdReturns a site by ID. |
Find Site RequestGet all sites for a country in csv file. Country id is specified as path parameter |
getSitesByAddrNomenTypeReturns sites having either full or partial address nomenclature (streets, quarters etc.). |
Find Site Request |
listStreetTypesReturns a list of the most common types of streets. |
Find Country Request |
listQuarterTypesReturns a list of the most common types of quarters (districts). |
Find Country Request |
listStreetsReturns a list of streets matching the search criteria. |
Find Street RequestGet street by id. Street id is provided as parameter in URL path |
listQuartersReturns a list of quarters matching the search criteria. |
Find Complex Request |
listCommonObjectsReturns a list of common objects matching the search criteria. |
Find POI Reques |
listBlocksReturns a list of blocks matching the search criteria. |
Find Block RequestGet all blocks for a country in csv file. Country id is specified as path parameter. |
listOfficesReturns a list of Speedy offices matching the search criteria. The method is deprecated. Use "listOfficesEx" instead |
Find Office RequestGet office by id. Office id is provided as parameter in URL path |
listOfficesExReturns a list of Speedy offices matching the search criteria. The difference with "listOffice" method is in returning data structure |
Find Office Request |
getAdditionalUserParamsReturns the list of additional user parameters |
There is no such method in API. |
getClientByIdReturns data for client by ID. Allowed values for clientId are only the ones of members of the user's contract and the predefined partners in the WebClients application. |
Get Client RequestClient id is provided as URL path paramter. The response is the same as method using JSON schema. |
searchClientsReturns data for clients by specified client id or other search criteria. |
Get Contact By External Id Request |
listContractClientsReturns all client objects ( including logged user's ) having the same contract as logged client's contract. |
Get Contract Clients Request |
getAllowedDaysForTakingReturns the dates when the shipment can be ordered for pick-up. |
Pickup Terms Request |
addressSearchReturns a list of addresses matching the search criteria. |
There is no such method in API. |
calculateThis method could be used for preliminary check-up of shipment's price. |
Calculation Request |
calculateMultipleServicesThis method could be used for preliminary check-up of shipment's price for a range of courier services. |
Calculation Request |
calculatePickingThis is an alternative method for shipment price calculation where the parameter is of type ParamPicking. Clients are encouraged to use the method that best fits their needs. |
Calculation Request |
createBillOfLadingThe method used to create BOL. |
Create Shipment Request |
createPDFUsed for creating PDF documents to be printed (BOLs, labels etc.) |
Print Request |
createPDFexUsed for creating PDF documents to be printed (BOLs, labels etc.). Extension method for createPDF returning more detailed information. |
Extended Print Request |
getRoutingLabelInfoReturns routing information for specified parcel number. |
Label Info Request |
invalidatePickingUsed to cancel BOL. Only allowed when the shipment is not picked up by Speedy. |
Cancel Shipment Request |
updateBillOfLadingThis method is used to update BOL (only allowed if BOL was created with pendingShipmentDescription = true). |
Update Shipment RequestFull update of already created shipment. Allowed only if shipment is not requested for pick up or is not picked up yet.Currently saved shipment data is cleared and replaced with new shipment data |
addParcelThis method is used to add parcel to an existing BOL (only allowed if BOL was created with pendingParcelsDescription = true). |
Add parcel RequestParcels can be added to shipments in pending parcels state (shipments created with pendingParcels flag true) |
finalizeBillOfLadingCreationMakes BOL "fully created" (only applies to BOLs created with pendingParcelsDescription = true). |
Finalize Pending Shipment Request |
createOrderCreates an order for shipments pick-up (i.e. a visit by courier of Speedy). |
Pickup Request |
getPickingParcelsReturns a list with all parcels of a shipment. |
Shipment Information Request |
trackPickingThis method is deprecated. Use trackPickingEx instead. |
Track Request |
trackPickingExThis method can be used to track the state/history of a shipment. |
Track Request |
trackParcelThis method can be used to track the state/history of a shipment. |
Track Request |
trackParcelMultipleThis method can be used to track the state/history of a shipment or a number of shipments. |
Track Request |
searchPickingsByRefNumberSearch BOLs by reference codes (ref1 and/or ref2). |
Find Parcels By Reference Request |
getMicroregionIdReturns the microregion id for provided GPS coordinates. |
There is no such method in API. |
listSpecialDeliveryRequirementsReturns list with available special delivery requirements for logged user. |
Contract Info RequestGet information about logged user contract |
validateAddressValidates address and returns result flag. |
Validate AddressThis method validates shipment address |
serializeAddressReturns JSON representation of specified address object |
There is no such method in API. |
deserializeAddressReturns ParamAddress constructed from specified JSON address string |
There is no such method in API. |
makeAddressStringReturns ResultAddressString, providing information about specified address parameter. |
There is no such method in API. |
listCountriesReturns a list of countries matching the search criteria. |
Find Country Request |
listCountriesExReturns a list of countries matching the search criteria. |
Find Country Request |
listStatesReturns list of states for a country that match search criteria |
Find State Request |
getStateByIdReturns state by id |
Find State Request |
validatePostCodeif siteId is provided: validates the post code against the site's post code range |
Validate Postcode Request |
searchSecondaryPickingsReturns a list with all not canceled pickings, which are secondary to the picking with the specified billOfLading. |
Secondary Shipments Request |
getPickingExtendedInfoReturns extended information about the picking with the specified billOfLading. |
Shipment Information Request |
convertToWin1251Returns the transliterated input text as result, it excludes latin characters (a-z, A-Z), cyrillic characters (а-я, А–Я) and digits (0-9). |
It is automated when it is necessary. |
mapForeignBarcodeAssociates foreign parcel number to provided parcel Id. |
There is no such method in API. |