Jump to content

Problem With Client Edit Via Api


Anuranjan

Recommended Posts

Hi,

 

I am facing problem while updating client details via api. Error is : 

 

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 : 

$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 :)

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...