This API call returns the merchants products.
API Function: get_products
| Name | Type | Description |
| username | string | Your API username. You should have received this with your account |
| subscription_id | string | Your Subscription ID. You can copy or regenerate it from your API management interface. |
| country_id | numeric | The ID of the country to return descriptions for. This field must be always equal or greater than 1 |
| Filters | ||
| offset | numeric | Enter the start point from where the API should return the rows |
| limit | numeric | Enter the number of rows that API should return. |
| order_by | string | Order the results . Can take one of the following values ['product_id', 'product_title', 'product_price', 'product_salediscount', 'product_salediscount'] |
| merchant_id | numeric | The ID of the desired merchant. You can use this parameter to get offers provided by a specific merchant. To obtain a list of merchants please read the "Merchants" section. |
| category_id | numeric | The ID of the desired category. Use this to obtain offers belonging to a single category. To obtain a list of categories please read the "Categories" section. |
| search_term | string | Use this if you want to filter the results based on a specific keyword. |
| extra_currency | string | Use this if you want to get the original price converted in a specific currency. You should use currencies iso codes |
Response fields:
| Name | Type | Description |
| product_id | numeric | The unique ID associated with the product |
| merchant_id | numeric | The unique ID of the merchant associated witht he product |
| program_id | numeric | The id of the program associated with the product |
| product_title | string | The product title (utf8 encoded) |
| product_description | string | The product description (utf8 encoded) |
| product_price | numeric | The product price |
| product_currency | string | The product currency |
| price_in_extra_currency | numeric | The product price in currency requested |
| product_image | string | The product image |
| product_brand | string | The product brand |
| product_category | string | The product category |
| product_onsale | string | The product onsale status |
| product_salediscount | numeric | The product sale discount |
| product_ean | string | The product ean code |
| affiliate_url | string | The product affiliate url (url encoded) |
<?php
$api_username = '*******';
$api_subscription = '*******';
$api_country_id = 221; // replace with your country id
$offset = 0;
$have_products = TRUE;
try
{
$client = new SoapClient('https://synced.io/api/v2_products?wsdl', array('trace' => 1));
while ($have_products)
{
$soapstruct = array("offset" => $offset, "limit" => "100");
$response = $client->get_products($api_username, $api_subscription, $api_country_id, $soapstruct);
if (!isset($response->product) || empty($response->product))
{
$have_products = FALSE;
die('No products');
}
print_r($response->product);
$offset += 100;
}
} catch (Exception $e)
{
print_r($e);
echo $client->__getLastRequest() . "\n";
exit;
}
?>