REST API: Convert a Lead to Account

Hello,

We have a web form that potential clients fill out. A lead is created from this form. If they continue to make a purchase we want to convert this Lead to an Account (using the REST API). Currently, it seems there is no such functionality in the API. Can anyone confirm this or am I not thinking about it right?

I am not opposed to extending the API with this functionality, but I am quite new to SuiteCRM and am not very familiar with the code. Does anyone have any good examples for extending the API?

Thanks

Well, I realized this was an obvious question once I took another look…

Basic solution:

      
//Set status to converted (Since an id is supplied, create_single_record will update)
$suite_crm->create_single_record('Leads', [['name' => 'id', 'value' =>$lead_id], ['name'=>'status', 'value'=>'Converted']]);

//Set contact relationship to lead
$suite_crm->set_relationship('Contacts', $suite_contact->id, 'leads', [$lead_id], []);

//Set account relationship to lead
$suite_crm->set_relationship('Accounts', $suite_account->id, 'leads', [$lead_id], []);

//Set account/contact relationship
$suite_crm->set_relationship('Accounts', $suite_account->id, 'contacts', [$suite_contact->id], []);

Of course one would want to ensure proper sanity checks and use the set_relationships method instead…

Hi @gunnerman is this for the V4 API? do you know how to achieve this with the v8 API?

Thank you!