gregM57 Posted April 4, 2011 Share Posted April 4, 2011 Hello everyone,I'm currently working with my team on a prestashop project for a couple of month and all of us were waiting for the version 1.4. Now that it has been released, we're encountering some bugs, some of them has been solved (mainly by us) but others are still remaining!!The main subject of this topic is how to upload a file ?? We've found out that in the WebserviceRequest file line 1852, a code has been created to add a node image to the current xml. Unfortunately it doesn't work at all! It only returns the existing list without our new node! See code bellow. if ($available_image_ids) { $this->_xmlOutput .= ''."\n"; foreach ($available_image_ids as $available_image_id) $this->_xmlOutput .= ''."\n"; $this->_xmlOutput .= ''."\n"; return true; } Does anyone succeed to upload a new image ? Are we the only one having this problem ?By the way where is the documentation ???Warm regardsGreg. Link to comment Share on other sites More sharing options...
mikih57 Posted April 8, 2011 Share Posted April 8, 2011 Hi, I'm interested by this code. I would like upload a file by using the werbservice. Nb :I work with Greg on project that uses the webservice, we can't finish because of this bugs. Link to comment Share on other sites More sharing options...
Chrille Posted April 8, 2011 Share Posted April 8, 2011 You are not alone my friends, I'm also having these problems. From what I understand of /api/images it's not possible to POST to products? How far have you come? Link to comment Share on other sites More sharing options...
mikih57 Posted April 8, 2011 Share Posted April 8, 2011 Hi dude,it's explain that it's not possible to put a picture (put="false"),but we have succeding to update a picture (Just the pictures linked to a product)Good night Link to comment Share on other sites More sharing options...
Chrille Posted April 8, 2011 Share Posted April 8, 2011 How did you do to update the picture? Link to comment Share on other sites More sharing options...
mikih57 Posted April 8, 2011 Share Posted April 8, 2011 Sure, $curl = curl_init(); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_URL, ‘http://your-site.com/api/images/products/10/1’); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_HTTPAUTH, ‘CURLAUTH_BASIC’); curl_setopt($curl, CURLOPT_USERPWD, ‘FHKEHFHFHHGFHRG3PLVQT3C1QUNM:’); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); $response = curl_exec($curl); curl_close($curl); Ps : Thanks to Tarmax for the explications 1 Link to comment Share on other sites More sharing options...
Chrille Posted April 9, 2011 Share Posted April 9, 2011 Could you also send what $data contains? Link to comment Share on other sites More sharing options...
Chrille Posted April 9, 2011 Share Posted April 9, 2011 Please? Link to comment Share on other sites More sharing options...
Chrille Posted April 10, 2011 Share Posted April 10, 2011 It looks like the image file should be named "image", but when I set $data to this I'm getting "bad request". Any ideas why? $data = array('xml'=>$xml, 'image'=>"@"."/var/www/img/logo.jpg"); (I'm POST:ing it to /api/images/products/14/1) Link to comment Share on other sites More sharing options...
damien13 Posted July 12, 2011 Share Posted July 12, 2011 Hi,This topic is quite old but I think I may have the answer to this.In your case, you should POST to /api/images/products/14 where 14 is the product_id.You should add also the mime-type of the image and the xml data is not required. $data = array('image'=>"@"."/var/www/img/logo.jpg;type=image/jpeg"); Damien Link to comment Share on other sites More sharing options...
roland_d_alsace Posted March 21, 2012 Share Posted March 21, 2012 Hi. This topic is old sure, but there are not a lot topics with this subject. Do you know how can i have the picture ID after uploading. In effect with PS 1.4.7 you mut to make a product association afte pictures uploading and some other actions. PS Webservice API don't make this alone After uploading Prestashop send one more time the picture in response after uploding (1.4.7) and send nothing else (no xml). This is not very interesting like response..... Other, PS need a legend (problem in backoffice after uploading picture. How can i fell the image_lang table ? Regards Thanks. Regards. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now