EntityTag.create throws error if entity has already been tagged
When trying to tag an entity that has already been tagged with the same tag, the API returns "Unable to add tags".
drush cvapi EntityTag.create tag_id="Foo" entity_table="civicrm_contact" entity_id=1
Repeat the same request twice and you'll see the error.
This is actually a fairly old regression (we noticed this while upgrading from 4.6) introduced with c6835264.
I don't think the current behaviour makes sense, and it doesn't seem to match what other APIs (such as
GroupContact.create) do in similar scenarios. It does seem to cause breakage occasionally, e.g. here in CiviRules: extensions/civirules#15 (closed)
I guess the idea behind c6835264 was to throw a more explicit error if tags were not added due to ACL issues. I'm pretty sure
GroupContact.create has a similar use-case and doesn't do that.
I'm happy to provide a PR to remove or refine this check if that seems like the way to resolve this.