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? here you have an example or relating records with REST

best regards