Jump to content

[Webservice] Création de catégorie -> erreur 400


Recommended Posts

Hello tout le monde!

 

J'essaie de créer une catégorie avec le code suivant mais il me retourne sans cesse une erreur 400

$webService = new PrestaShopWebservice($url, PS_WS_AUTH_KEY, DEBUG);
$xml = $webService->get(array('url' => $url.'/api/categories?schema=blank'));
$category = $xml->children()->children();
$category->name->language[0][0] = "test";
$category->link_rewrite->language[0][0] = "test";
$category->active = 1;	
   	
$opt = array('resource' => 'categories');
$opt['postXml'] = $xml->asXML();
$xml = $webService->add($opt);  

J'ai essayé de changé "blank" par "synopsis" mais ca ne change rien. Quelqu'un a déjà eu ce soucis?

 

Merci à toute la communauté!!

 

Share this post


Link to post
Share on other sites

Voici l'ensemble de l'erreur :

 

Fatal error: Uncaught exception 'PrestaShopWebserviceException' with message 'This call to PrestaShop Web Services failed and returned an HTTP status of 400. That means: Bad Request.' in /Users/xxxx/Documents/bitbucket/flux/prestashop/PSWebServiceLibrary.php:91

Stack trace:

#0 /Users/xxxx/Documents/bitbucket/flux/prestashop/PSWebServiceLibrary.php(241): PrestaShopWebservice->checkStatusCode(400)

#1 /Users/xxxx/Documents/bitbucket/flux/prestashop/createWebsite.php(83): PrestaShopWebservice->add(Array)

#2 {main}

  thrown in /Users/xxxx/Documents/bitbucket/flux/prestashop/PSWebServiceLibrary.php on line 91

Edited by marc_mirsounet (see edit history)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More