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:
{
"userName" : "xxxxxx",
"password" : "yyyyyy",
"language" : "EN",
"service" : {
"serviceId" : 505,
"additionalServices" : {
"cod" : {
"amount" : 100.0,
"processingType" : "CASH"
},
"declaredValue" : {
"amount" : 100.0,
"fragile" : true,
"ignoreIfNotApplicable" : true
},
"obpd" : {
"option" : "OPEN",
"returnShipmentServiceId" : 505,
"returnShipmentPayer" : "SENDER"
}
},
"saturdayDelivery" : true,
"autoAdjustPickupDate" : true
},
"content" : {
"parcelsCount" : 1,
"totalWeight" : 0.6,
"contents" : "MOBILE PHONE",
"package" : "BOX"
},
"payment" : {
"courierServicePayer" : "RECIPIENT",
"declaredValuePayer" : "RECIPIENT"
},
"sender" : {
"phone1" : {
"number" : "0888112233"
},
"contactName" : "IVAN PETROV",
"email" : "[email protected]"
},
"recipient" : {
"phone1" : {
"number" : "0899445566"
},
"clientName" : "VASIL GEORGIEV",
"email" : "[email protected]",
"privatePerson" : true,
"address" : {
"countryId" : 100,
"siteId" : 68134,
"streetId" : 3109,
"streetNo" : "1A",
"complexId" : 29,
"blockNo" : "301",
"entranceNo" : "2",
"floorNo" : "3",
"apartmentNo" : "4"
}
},
"ref1" : "ORDER 123456"
}
|
#-> 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:
{
"userName" : "xxxxxx",
"password" : "yyyyyy",
"language" : "EN",
"service" : {
"serviceId" : 505,
"additionalServices" : {
"cod" : {
"amount" : 100.0,
"processingType" : "CASH"
},
"declaredValue" : {
"amount" : 100.0,
"fragile" : true,
"ignoreIfNotApplicable" : true
},
"obpd" : {
"option" : "OPEN",
"returnShipmentServiceId" : 505,
"returnShipmentPayer" : "SENDER"
}
},
"saturdayDelivery" : true,
"autoAdjustPickupDate" : true
},
"content" : {
"parcelsCount" : 1,
"totalWeight" : 0.6,
"contents" : "MOBILE PHONE",
"package" : "BOX"
},
"payment" : {
"courierServicePayer" : "RECIPIENT",
"declaredValuePayer" : "RECIPIENT"
},
"sender" : {
"phone1" : {
"number" : "0888112233"
},
"contactName" : "IVAN PETROV",
"email" : "[email protected]"
},
"recipient" : {
"phone1" : {
"number" : "0899445566"
},
"clientName" : "VASIL GEORGIEV",
"email" : "[email protected]",
"privatePerson" : true,
"pickupOfficeId" : 14
},
"ref1" : "ORDER 123456"
}
|
#-> 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:
{
"userName" : "xxxxxx",
"password" : "yyyyyy",
"language" : "EN",
"service" : {
"serviceId" : 312,
"saturdayDelivery" : false,
"autoAdjustPickupDate" : true
},
"content" : {
"parcelsCount" : 1,
"totalWeight" : 0.5,
"contents" : "Books",
"package" : "ENVELOPE"
},
"payment" : {
"courierServicePayer" : "SENDER"
},
"sender" : {
"phone1" : {
"number" : "0888112233"
},
"contactName" : "IVAN PETROV",
"email" : "[email protected]",
"dropoffOfficeId" : 52
},
"recipient" : {
"phone1" : {
"number" : "0899445566"
},
"clientName" : "VASIL GEORGIEV",
"email" : "[email protected]",
"privatePerson" : true,
"address" : {
"countryId" : 100,
"siteId" : 68134,
"streetId" : 3109,
"streetNo" : "1A",
"complexId" : 29,
"blockNo" : "301",
"entranceNo" : "2",
"floorNo" : "3",
"apartmentNo" : "4"
},
},
"ref1" : "Order: 123456"
}
|
#-> Example 1d. An injected shipment in an office in Greece to an address in Greece.
#-> I. SENDER
$senderArray = array(
'contactName' => 'JOHN SMITH',
'phone1' => array(
'number' => '+30217654321'
),
'email' => '[email protected]',
'dropoffOfficeId' => 52
);
#-> II. RECIPIENT
$recipientArray = array(
'clientName' => 'GEORGIOS PAPADOPULUS',
'phone1' => array(
'number' => '+30211234567'
),
'email' => '[email protected]',
'privatePerson' => true,
'address' => array(
'countryId' => 300, // GREECE
'siteName' => 'THESSALONIKI',
'postCode' => 54629,
'addressLine1' => '28 Monastiriou str',
'addressLine2' => 'Bus station' /* Not mandatory */
)
);
#-> III. SERVICE DETAILS
$serviceArray = array(
'autoAdjustPickupDate' => true,
'serviceId' => 312,
'saturdayDelivery' => false
);
#-> IV. CONTENT OF THE PARCEL
$contentsArray = array(
'parcelsCount' => 1,
'contents' => 'Books',
'package' => 'ENVELOPE',
'totalWeight' => 0.5
);
#-> V. PAYMENTS
$paymentsArray = array(
'courierServicePayer' => 'SENDER', // (SENDER, RECIPIENT, THIRD_PARTY)
);
#-> VI. JSON DATA
$jsonData = array(
'userName' => SPEEDY_API_USERNAME,
'password' => SPEEDY_API_PASSWORD,
'language' => 'EN',
'sender' => $senderArray,
'recipient' => $recipientArray,
'service' => $serviceArray,
'content' => $contentsArray,
'payment' => $paymentsArray,
'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);
|
An injected shipment in an office in Greece to an address in Greece:
{
"userName" : "xxxxxx",
"password" : "yyyyyy",
"language" : "EN",
"sender" : {
"phone1" : {
"number" : "+30217654321"
},
"contactName" : "JOHN SMITH",
"email" : "[email protected]",
"dropoffOfficeId" : 52
},
"recipient" : {
"phone1" : {
"number" : "+30211234567"
},
"clientName" : "GEORGIOS PAPADOPULUS",
"email" : "[email protected]",
"privatePerson" : true,
"address" : {
"countryId" : 300,
"siteName" : "THESSALONIKI",
"postCode" : "54629",
"addressLine1" : "28 Monastiriou str",
"addressLine2" : "Bus station"
}
},
"service" : {
"serviceId" : 312,
"saturdayDelivery" : false,
"autoAdjustPickupDate" : true
},
"content" : {
"parcelsCount" : 1,
"totalWeight" : 0.5,
"contents" : "Books",
"package" : "ENVELOPE"
},
"payment" : {
"courierServicePayer" : "SENDER"
},
"ref1" : "Order: 123456"
}
|
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 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: |
#-> 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"
}
}
|
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"
}
|