I can successfully make a patch request to the tooling api to update a custom fields api name. However, if I include any of the field properties in the CustomFieldMetadata object I get an internal salesforce error.
successful request:
PATCH: /services/data/v29.0/tooling/sobjects/CustomFieldDefinition/{ID} { "DeveloperName" : "NewName" }
failed request:
PATCH: /services/data/v29.0/tooling/sobjects/CustomFieldDefinition/{ID} { "DeveloperName" : "NewName", "Metadata" : {"length": 100} }
gack ids:
118968544-21444 (-1657627855)
1623052628-129393 (-1657627855)
Answer
This is a known issue with the tooling api with no current ETA for the fix. The bug number is W-1904760.
For other people who want to programmatically work with their custom field metadata I would recommend Andrew Fawcett’s excellent metadata api wrapper.
Attribution
Source : Link , Question Author : Greg Grinberg , Answer Author : Greg Grinberg