Jump to content

Custom Webservice error 400


AndDM

Recommended Posts

Hi, i've necessity to manage multiple warehouse movements, but with actual webservice i can't do all action that i need, so i've started a new webservice, based on this resource: http://webkul.com/blog/how-to-add-new-tables-in-rest-api-of-prestashop/
I've created the service, but i've this error:

This call to PrestaShop Web Services failed and returned an HTTP status of 400. That means: Bad Request.

when i've checked the schema, i saw that the schema response is empty. Have you some suggestions on this problem?

Thanks for your time.
Best regards.

Link to comment
Share on other sites

Hi, unfortunaly, i've found any other resource that explain that, i've enable logs and i've found:

PHP Fatal error:  Uncaught exception 'PrestaShopException' with message 'Identifier or table format not valid for class ProductMovementsCore' in /home/andrea/projects/prestashop/classes/ObjectModel.php:194#012Stack trace:#012#0 /home/andrea/projects/prestashop/classes/webservice/WebserviceRequest.php(508): ObjectModelCore->__construct()#012#1 /home/andrea/projects/prestashop/webservice/dispatcher.php(90): WebserviceRequestCore->fetch('267C2S8INF8HETK...', 'GET', 'crm_product_mov...', Array, false, NULL)#012#2 {main}#012  thrown in /home/andrea/projects/prestashop/classes/ObjectModel.php on line 194

My class:

<?php
class ProductMovementsCore extends ObjectModel {   
    public $crm_product_id;
    public $prestashop_product_id;
    public $modified_at;
    public $updated_qty;
    public $available_qty;
    public $platform;
    
    public static $definition = array(
        'table' => 'crm_product_movements',
        'primary' => 'id',
        'fields' => array(
            'crm_product_id' => array('type' => self::TYPE_INT, 'required' => false),
            'prestashop_product_id' => array('type' => self::TYPE_INT,  'required' => false),
            'modified_at' => array('type' => self::TYPE_STRING,  'required' => true, 'size' => 64),
            'updated_qty' => array('type' => self::TYPE_INT,  'required' => true),
            'available_qty' => array('type' => self::TYPE_INT,  'required' => true),
            'platform' => array('type' => self::TYPE_STRING,  'required' => true, 'size' => 64),
        ),
    );
    protected $webserviceParameters = array();
}

Thanks for your time.

Best regards.

Link to comment
Share on other sites

×
×
  • Create New...