Use
The private API allows you to send your customers' orders to us.
-
Usage Quotas: unlimitedThis API is not subject to a quota of requests.
-
Authentication: yesA key authentication is required to access and send data.
-
Email sending delay: 10 daysStarting from the date of receipt of your orders via the API, your customers will be contacted 10 days later by email.
Order shipping
The following parameters must be used to customize the query:
-
api_key string, mandatoryUnique private key to access the API
-
orders json, mandatoryOrders table (encoded in JSON)
-
id_order string, mandatoryUnique order ID
-
order_date string, mandatoryOrder date and time in the format YYYY-MM-DD HH:MM:SS
-
firstname string, mandatoryCustomer's first name
-
lastname string, mandatoryCustomer name
-
email string, mandatoryCustomer email address
-
reference stringUnique order reference
-
store_id integerUnique store ID (if applicable)
-
products arrayTable containing the list of ordered products
-
id integer, mandatoryUnique product ID
-
name string, mandatoryProduct name
-
category_id stringProduct category ID
-
category_name stringProduct category name
-
qty integerQuantity of the product in the order
-
unit_price floatUnit price of the product (tax included)
-
mpn stringProduct MPN code
-
ean13 stringProduct EAN13 code
-
sku stringProduct SKU code
-
upc stringProduct UPC code
-
url stringProduct URL
Endpoint
https://api.guaranteed-reviews.com/private/v3/orders
Example call (PHP cURL)
<?php
// Define API endpoint and API key
$apiEndPoint = "https://api.guaranteed-reviews.com/private/v3/orders";
$apiKey = "YOUR_PRIVATE_KEY";
// Prepare data
$post = array(
'api_key' => $apiKey,
'orders' => json_encode(
array(
array(
'id_order' => '1234',
'order_date' => '2019-01-01 12:00:00',
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[email protected]',
'reference' => '12345678',
'store_id' => 0,
'products' => array(
array(
'id' => '100',
'name' => 'My Product 100',
'category_id' => 'cat1',
'category_name' => 'Category 1',
'qty' => '1',
'unit_price' => '25.90',
'mpn' => 'MPN100',
'ean13' => '1234567890123',
'sku' => 'SKU100',
'upc' => 'UPCCODE',
'url' => 'https://www.mywebsite.com/myproduct/',
),
),
),
),
),
);
// Prepare CURL request
$ch = curl_init($apiEndPoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
// Execute CURL request
$response = curl_exec($ch);
// Close the connection, release resources used
curl_close($ch);
// Do anything you want with your response !
var_dump($response);
?>
Values returned by the API
The API returns a response containing a 'success' object.
-
success integerReturn '1' if at least one order has been imported or '0' if no orders have been imported.
-
orders_count integerReturns the total number of orders transmitted in the call
-
orders_imported integerReturns the total number of orders actually imported
WARNING: An order will not be re-imported if another order with the same id_order or reference has already been sent. -
message stringReturns a possible message containing more information about an error during import.
Example of an API response for a successfully imported order:
JSON
{
"success": 1,
"orders_count": 1,
"orders_imported": 1,
"message": null
}
Example of an API response in the case of already imported orders:
JSON
{
"success": 0,
"orders_count": 1,
"orders_imported": 0,
"message": "Some orders were not imported because they had already been sent (see documentation)"
}