While trying to alter Contact Relationships Permission ("Contact A can view and update information about Contact B") using this code:
$result = civicrm_api3('Relationship', 'create', array( 'debug' => 1, 'contact_id_a' => 111, 'contact_id_b' => 111, 'relationship_type_id' => 111, 'id' => 111, 'is_permission_a_b' => 0, /* <- This was manually set as 1 and need to be altered */ ));
we've got "duplicate relationship" error message
"error_message": "Duplicate Relationship"
Deprecated "setvalue/update" suggestion is "Use "create" with an id instead." and we do have all IDs in place. Does 'Create' for Relationships work as it works for Contacts or we've missed something?
After some debugging it has turned that we have exactly same situation described here How to change the direction of a relationship type with existing data , but we weren't aware that changing Relationship direction via GUI doesn't make change in a database. Sounds like another civicrm bug.
UPDATE 2 Even after Relationship directions have been altered, same error "Duplicate Relationships" appears at an attempt to ALTER one of Relationship parameter using CREATE Action via CiviCRM Api.