Custom field API and Custom field Machine name
If I understand right, the CustomField 'name' is unique in every CustomGroup. In my prototype I have two CustomFields 'Role' but they have two different 'custom_group_id'. When I try to add a 'Role' CustomField to either one of these CustomGroups, then it errors out with the message:

Field Label
Custom field 'Role' already exists in Database.

But I can still add 'Role to any other CustomGroup where it is not used yet. 

In the form I can only set the label, but at creation the 'name' is created from the label. When I rename the label, the 'name' is unchanged. This is the machine name of CustomField. 

So before you push, you should do a query on both:

$result = civicrm_api3('CustomField', 'get', array(
  'sequential' =&gt; 1,
  'custom_group_id' =&gt; "Entity",
  'name' =&gt; "Role",
));


This will return the right id and will allow you to do your push. Then it is very useful to straight away to use the returned id through api chaining.