Posted by: Eric Hansen
I couldn’t wait to write this section. The API is both a blessing and a damn curse rolled into one.
First thing, the API works by parsing XML both in and out. So, you poll the API service to retrieve a XML structure of data that you then manipulate and send back. Not a horrible idea, in theory.
I’ve never been a fan of XML for this purpose to begin with, but I’m not biased in this review either. Getting the data is a piece of cake. The problem comes in trying to figure out what you need to edit and what you have to take out. It doesn’t do it for you, its nothing but trial and error. Now, this wouldn’t really be a complaint IF the documentation would tell you. But the documentation for the API is just as vague.
Probably my biggest gripe, is the API helper they give you for PHP doesn’t technically support the newest versions of PrestaShop. You have to edit a line to tell it to support version 188.8.131.52 (which is the most recent at the time of writing).
Not only that, but as I said, the API is nothing but trial and error. I spent a good 4-5 hours trying to figure out why I couldn’t insert a product. Even when I enabled debugging/dev mode, the responses were nothing but “Error: 400. This means a bad request.” Okay? What bad request? Nothing in the error logs, nothing else spit out, closest thing I knew is it had to deal with line 214 in the API helper script. Yeah, not great.
Then, I kept getting an error stating bad parameters given. Apparently, there’s some fields that, even though it gives you in the XML, you have to remove yourself. Not very intuitive, and if it wasn’t for it had everything I wanted and I didn’t like the other solutions, I would’ve ditched it.
It gets better, and worse, though at the same time. Right now I still haven’t figured out how to properly add a new image to a product, but I’ll figure that out after Easter.