Closed lwillems closed 6 years ago
Can you send the exact error?
Also few remarks:
78909
cURL error 52: Empty reply from server vendor/rmccue/requests/library/Requests/Transport/cURL.php at line 422
I have updated my code sample above and try it again with itemId as string, but same error.
Regards
That's strange. This works for me:
$formattedItem =
[
"sku"=>78909,
"quantity"=>0,
"hash"=>"xxxxxx",
"category"=>"Coins , France , 1901-2001 , h. 1 franc",
"categoryPath"=>"1108.1215.1244.1253",
"featured"=>false,
"price_eur"=>8,
"name_en"=>"Coin, France, Semeuse, Franc, 1916, Paris, AU(55-58), Silver, KM:844.1",
"name_fr"=>"Monnaie, France, Semeuse, Franc, 1916, Paris, SUP, Argent, KM:844.1, Gadoury:467",
"name_de"=>"Münze, Frankreich, Semeuse, Franc, 1916, Paris, VZ, Silber, KM:844.1",
"name_it"=>"Moneta, Francia, Semeuse, Franc, 1916, Paris, SPL-, Argento, KM:844.1",
"name_es"=>"Moneda, Francia, Semeuse, Franc, 1916, Paris, EBC, Plata, KM:844.1, Gadoury:467",
"name_nl"=>"Munten, Frankrijk, Semeuse, Franc, 1916, Paris, PR, Zilver, KM:844.1",
"image_url_1"=>"https://cdn.shopify.com/s/files/1/0938/5674/products/8744ec3773c4becc1cfb66ea73a3c371.jpeg?v=1464169262",
"image_url_2"=>"https://cdn.shopify.com/s/files/1/0938/5674/products/9b0afeddef2a762d92ebb64ed9c5909b.jpeg?v=1464169262",
"url_en"=>"https://www.numiscorner.com/products/france-semeuse-franc-1916-paris-au55-58-silver-km-844-1-gadoury-468",
"url_fr"=>"https://www.numiscorner.fr/products/france-semeuse-franc-1916-paris-sup-argent-km-844-1-gadoury-467",
];
$r = new Reqs\SetItemValues(
"78909",
$formattedItem,
['cascadeCreate' => true,]
);
$client->send($r);
One unrelated suggestion: It would be better if category
(and maybe also categoryPath
) would be of type set
.
Hello,
Always the same error, even when i paste your code ... Can you check my request on your API to understand what's happen ?
Regars
With bulk method everything works (same content) ...
very strange, seems working randomly
failed
"sku" => 12523 "quantity" => 0 "hash" => "79d28d4a126e98f92093b45a4b0ae976" "category" => "Coins , France , 1795-1900 , n. 50 francs" "categoryPath" => "1108.1215.1226.1239" "featured" => true "price_eur" => 750.0 "name_en" => "FRANCE, Napoléon III, 50 Francs, 1857, Paris, KM #785.1, AU(50-53), Gold, Gadour" "name_fr" => "Second Empire, 50 Francs or tête nue" "name_de" => "FRANCE, Napoléon III, 50 Francs, 1857, Paris, KM #785.1, AU(50-53), Gold, Gadour" "name_it" => "Francia, Napoleon III, Napoléon III, 50 Francs, 1857, Paris, BB+, Oro, Gadou..." "name_es" => "FRANCE, Napoléon III, 50 Francs, 1857, Paris, KM #785.1, AU(50-53), Gold, Gadour" "name_nl" => "FRANCE, Napoléon III, 50 Francs, 1857, Paris, KM #785.1, AU(50-53), Gold, Gadour" "image_url_1" => "https://cdn.shopify.com/s/files/1/0938/5674/products/057179dca110206b94e19da6ee09df3e.jpeg?v=1459980054" "image_url_2" => "https://cdn.shopify.com/s/files/1/0938/5674/products/3bcd58cc5a2a20e6bc9fc1febfabb83c.jpeg?v=1459980054" "url_en" => "https://www.numiscorner.com/products/france-napoleon-iii-50-francs-1857-paris-km-785-1-au50-53-gold-gadour-17"
created
"sku" => 10693 "quantity" => 0 "hash" => "d6930e6c6e27645bc45260b8b5da04f5" "category" => "Antique , Byzantine , Constans II 641-668" "categoryPath" => "1396.1413.3522" "featured" => false "price_eur" => 650.0 "name_en" => "Constans II 641-668, Solidus, Constantinople, AU(55-58), Gold, 4.30" "name_fr" => "Constans II, Solidus" "name_de" => "Constans II 641-668, Solidus, Constantinople, AU(55-58), Gold, 4.30" "name_it" => "Constans II 641-668, Solidus, Constantinople, SPL-, Oro" "name_es" => "Constans II 641-668, Solidus, Constantinople, AU(55-58), Gold, 4.30" "name_nl" => "Constans II 641-668, Solidus, Constantinople, AU(55-58), Gold, 4.30" "image_url_1" => "https://cdn.shopify.com/s/files/1/0938/5674/products/6fb3db96b4bde2ca055e0e792578eea8.jpeg?v=1460454425" "image_url_2" => "https://cdn.shopify.com/s/files/1/0938/5674/products/fec9c91baf9ba981138be7a489a8694b.jpeg?v=1460454425" "url_en" => "https://www.numiscorner.com/products/constans-ii-641-668-solidus-constantinople-au55-58-gold-4-31"
It looks like part of your set item values requests ended up with HTTP 400 (invalid request, for example sending data in wrong format for given data type) - in that case ResponseException
was raised - can you please check the message in the exception? It should explain the cause.
I tried once more this:
$client = new Client( - name of your db -, - your token -);
$formattedItem =
[
"sku" => 12523,
"quantity" => 0,
"hash" => "79d28d4a126e98f92093b45a4b0ae976",
"category" => "Coins , France , 1795-1900 , n. 50 francs",
"categoryPath" => "1108.1215.1226.1239",
"featured" => true,
"price_eur" => 750.0,
"name_en" => "FRANCE, Napoléon III, 50 Francs, 1857, Paris, KM #785.1, AU(50-53), Gold, Gadour",
"name_fr" => "Second Empire, 50 Francs or tête nue",
"name_de" => "FRANCE, Napoléon III, 50 Francs, 1857, Paris, KM #785.1, AU(50-53), Gold, Gadour",
"name_it" => "Francia, Napoleon III, Napoléon III, 50 Francs, 1857, Paris, BB+, Oro, Gadou...",
"name_es" => "FRANCE, Napoléon III, 50 Francs, 1857, Paris, KM #785.1, AU(50-53), Gold, Gadour",
"name_nl" => "FRANCE, Napoléon III, 50 Francs, 1857, Paris, KM #785.1, AU(50-53), Gold, Gadour",
"image_url_1" => "https://cdn.shopify.com/s/files/1/0938/5674/products/057179dca110206b94e19da6ee09df3e.jpeg?v=1459980054",
"image_url_2" => "https://cdn.shopify.com/s/files/1/0938/5674/products/3bcd58cc5a2a20e6bc9fc1febfabb83c.jpeg?v=1459980054",
"url_en" => "https://www.numiscorner.com/products/france-napoleon-iii-50-francs-1857-paris-km-785-1-au50-53-gold-gadour-17"
];
for($i=0;$i<100;$i++)
{
$r = new Reqs\SetItemValues(
"12523",
$formattedItem,
['cascadeCreate' => true,]
);
$res = $client->send($r);
var_dump($res);
}
?>
and received 100x:
string(2) "ok"
Exception is not the one expected but : Requests_Exception
Hi, could please try to send a request which failed many times (for example few hundred times) to see if it fails all the time for the particular request or not? Also, can you please try to send a request which according to your findings haven't failed yet (such as a Batch) many times, to see if it will fail with the cURL error or not?
My current belief (which should be proven or disproven by mentioned steps) is that the problems are not connected to some particular request, but rather to some network issue. Do you use something between your application and Recombee (such as a proxy)?
Hi, I am not using proxy and i have tried with several internet connection, always the same error. Batch fully works everytime. My customer was hurried to use his account, so i have developed my own API connector using Guzzle, sending the same body tried with sdk everything is working as expected this way.
Regards
I'm sad to hear that we couldn't help you to solve the issue. As we cannot reproduce it, it is very hard to debug it. As last thing - could you please share information about your environment (such as version of php, operating system, or anything else that you think can play a role)? If this issue will occur to someone else, these information may help us to find under what circumstances it happens. Thanks.
I do not think my environment is involved because I do not have the problem with all the resources but only SetItemValues. However : I use MAMP Pro on Mac ElCapitan PHP Version 7.1.4 If you think I can help do not hesitate to contact me again. Regards,
Hi Ondra
If you want to have a look, i have shared a standalone symfony2 bundle for recombee on packagist. https://packagist.org/packages/obtao/recombeebundle All API resources are not implement yet but commits will follow in the next weeks and to add a new one there is only one abstract class to duplicate and adapt.
Regards
Hi,
it seems nice and we are glad that you are releasing it publicly as open source :)
One note: You should not set firstName
, lastName
and email
as the properties of the users - they cannot be used anyhow for recommendation (we cannot know ones tastes just if we know that he is called John Smith), but with these attributes, things can get very complicated when it comes to data privacy laws. Generally the user data should be pseudonymized.
An example of user property which may make sense is country of origin, as in many domains popularity of items vary among the countries.
But we should probably move this discussion to your project ;)
Hi
Sorry for late reply i was busy on another project. Thanks for tips, i have updated user model in my repo. Feel free to open a new issue on my project to discuss.
Regards
Hello
Got a curl error trying to send an item with setItemValues :
Here's the json body dump :
When removing some properties response is ok from API, perhaps there is a limitation on body size ?
Regards