Jump to content

PrestaShop Web Service (PSWebServiceLibrary)


node49

Recommended Posts

Hi everybody!

 

Using Prestashop 1.5.5.0 or 1.5.3 I trying to make an products import using PSWebServiceLibrary.php but I`ve got an error and I can`t understand why...

 

I made xxx.php in my root www dir:

<html>
<head>
<title>prod import</title>
</head>
<body>

<?php
require_once( './PSWebServiceLibrary.php' );

// Here's how you create a webservice call:
$shop_url = 'http://192.168.20.200/prestashop1550/api/';
$secret_key = 'FCVW45NDHP5AGJZF3XACURP5F4JMJR81';
$debug = false;
//$webService = new PrestaShopWebservice($shop_url, $secret_key, $debug);

try {
// creating webservice access
$webService = new PrestaShopWebservice($shop_url, $secret_key, $debug);

// call to retrieve all clients
$xml = $webService->get(array('resource' => 'products?schema=synopsis'));
echo $xml;
}
catch (PrestaShopWebserviceException $ex) {
// Shows a message related to the error
echo 'Other error: <br />' . $ex->getMessage();
}
?>
</body>
</html>

And browser tell me:

 

 

Other error:
This call to PrestaShop Web Services failed and returned an HTTP status of 404. That means: Not Found.

This happening in this string:

$xml = $webService->get(array('resource' => 'products?schema=synopsis'));

 

I can`t understand why is it happening cause I try to do everything like in tutorial http://doc.prestasho...and list client

 

PS Perhaps someone have already made products import and can share his script?

Link to comment
Share on other sites

  • 2 weeks later...
  • 7 months later...

Hi node49, I know this is very old, but in searching for a solution for having the same problem, I found your question. In my case, my base shop URL was not correctly defined. Once I fixed that, my "Bad Request" went away, and I was able to pull my products. Hope this helps you, if you have not found the solution yet.

Link to comment
Share on other sites

  • 7 months later...

I've had similar problem with showing products on Joomla! pages. As I was just testing this, I've used my test server, where I've had mod_rewrite turned off and SEO friendly as well. Well, that was exactly that problem. Few hours after (and a lot of headache and nearly damaged keyboard :) ) I've tried this last thing before I give it up. And. Finally it worked without any small issue. So, just make sure I that you have mod_rewrite installed on your server and allowed and activate friendly URL in Preferences->SEO&URLs.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...