Could not get the API to add custom fields. Here are the steps - I'm using Beta 4 with Drupal 6.x -
Logged into Drupal
Went to /civicrm
Went to /civicrm/admin?reset=1
Went to admin/custom/group?reset=1
Chose "New Group..."
Gave a Group Name, specified for Contacts, saved
Added 3 fields with the UI - "State", "Party", "First Time" - all alphanumeric, all searchable
Found the field id number by looking at the URL for the edit (and confirmed in
Executed the following code:
$params = array( 'contact_type' => 'Individual',
'first_name' => 'Foo',
'last_name' => 'Fighter',
'custom_4' => 'Edu',);
$result = civicrm_contact_add( $params );
CRM_Core_Error::debug( $result );
The user was added but the custom field did not populate.
truncated civicrm_cache and then it worked.