Adding Relationships Through REST

Module A is linked to Module B through a relate field. I would like to update this relationship through the rest api. I would like to take Module A Record 1 and remove it current relationship with Module B Record 1 and add a new relationship to Module B Record 2.

What are the possible workflows for accomplishing this? Which is the best?

https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Application_Framework/Web_Services/Examples/REST/PHP/Relating_Quotes_and_Products/ here you have an example or relating records with REST

best regards