When accessing the Keap database through the PHP SDK, is there a way to query the products table by SKU – specifically, send a SKU as the search string and get back the matching Product ID(s)?
I don’t see that the REST V1 or V2 support filtering for the SKU, but you could use the XMLRPC data service with the Infusionsoft PHP SDK (which is now deprecated).
$result = $infusionsoft->data(‘xml’)->query(‘Product’, 1000, 0, array(‘Sku’ => ‘test-01’), array(‘Id’, ‘ProductName’, ‘Sku’), ‘Id’, true);
Currently, it is not possible to retrieve products directly by SKU using either the new PHP SDK or Keap’s REST APIs (v1 or v2).
The only way to search products by SKU is using the legacy PHP SDK with XML-RPC(which is not recomended to use because its deprecated ), for example:
$product = $infusionsoft->data()->query(
'Product', // Table
5, // Limit
0, // Page
['Sku' => 'prd-299'],// Query data (search by SKU)
['Id','ProductName'],// Fields to return
'Id', // Order by
true // Ascending
);
This would return something like:
Array
(
[0] => Array
[ProductName] => TestProduct
[Id] => 4
)
)
IMPORTANT: this approach is not recommended, as XML-RPC is deprecated.
Hi @Sean_Manning and @Marion_Dorsett2, the GET Product By SKU gap has been resolved. The API now allows you to get a product by SKU using the list products endpoint. For example:
products?filter=sku==ABC123
Our docs and SDKs are not updated yet, but this filter is already available. Just make sure the == operator is URL-encoded in the request (%3D%3D).