Anuranjan Posted January 16, 2014 Report Posted January 16, 2014 Hi, I am facing problem while updating client details via api. Error is : Quote your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `id` = '15'' at line 1stdClass Object([error] => stdClass Object([message] => An unexpected error occured.[response] => SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `id` = '15'' at line 1) My php code is : Quote $api = new BlestaApi($url, $user, $key); $data = array('client_id'=> 11, 'vars' => array('first_name' => 'Piyushh')); $response = $api->post("Clients", "edit", $data); Please help me guys!! Thanks in advance!! Cheers
Tyson Posted January 16, 2014 Report Posted January 16, 2014 Clients::edit() does not accept a 'first_name' vars parameter. It sounds like you want Contacts::edit(). e.g.: $params = array('contact_id' => 1, 'vars' => array('first_name' => "Piyushh")); $api->put("contacts", "edit", $params); Michael 1
Anuranjan Posted January 17, 2014 Author Report Posted January 17, 2014 Thank you Tyson! But I want to use Clients::edit(). Would you please explain me an example? I tried below code to edit first name of the client $data = array('client_id'=> 11, 'vars' => array('first_name' => 'Piyushh'));$response = $api->post("Clients", "edit", $data); But it thrown an error: your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `id` = '15'' at line 1stdClass Object
Cody Posted January 17, 2014 Report Posted January 17, 2014 On 1/17/2014 at 7:10 AM, Anuranjan said: Thank you Tyson! But I want to use Clients::edit(). Would you please explain me an example? I tried below code to edit first name of the client $data = array('client_id'=> 11, 'vars' => array('first_name' => 'Piyushh'));$response = $api->post("Clients", "edit", $data); But it thrown an error: your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `id` = '15'' at line 1stdClass Object Clients::edit is not the correct API command for what you're trying to do as Tyson said. That request only supports the following parameters (as explained in the source documentation): $vars An array of client info (all fields optional) including: - id_code The client's reference ID code (for display purposes) - user_id The client's user ID - client_group_id The client group this user belongs to - status The status of this client ('active', 'inactive',' 'fraud') Notice, first_name is not listed there. To modify the name of the client use Contacts::edit. First fetch the primary contact using Contacts::getAll by setting primary as the billing_type. Use the ID of the contact returned in the Contacts::edit request.
Anuranjan Posted January 20, 2014 Author Report Posted January 20, 2014 On 1/17/2014 at 4:39 PM, Cody said: Clients::edit is not the correct API command for what you're trying to do as Tyson said. That request only supports the following parameters (as explained in the source documentation): $vars An array of client info (all fields optional) including: - id_code The client's reference ID code (for display purposes) - user_id The client's user ID - client_group_id The client group this user belongs to - status The status of this client ('active', 'inactive',' 'fraud') Notice, first_name is not listed there. To modify the name of the client use Contacts::edit. First fetch the primary contact using Contacts::getAll by setting primary as the billing_type. Use the ID of the contact returned in the Contacts::edit request. I got that Cody. Thanks a lot.
anaya Posted February 3, 2014 Report Posted February 3, 2014 I can remove the /configure/ and /id/ to just have /order/ORDER_Form_Label/ correct? That will not cause hangups will it?
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now