Hi I created a module which utilised the api channel methods to insert entries into the system it was working well for 2.1.0 but now i’ve used it for another 2.1.3 project it’s throwing this error:
Message: Undefined index: field_type
Filename: api/Api_channel_fields.php
Line Number: 256The code i pass into the api_channel_entries->submit_new_entry function is:
Array
(
[author_id] => 1
[title] => My Shoes
[url_title] => my-shoes
[entry_date] => 1295866693
[versioning_enabled] => n
[year] => 2011
[month] => 01
[day] => 24
[expiration_date] =>
[comment_expiration_date] =>
[status] => open
[allow_comments] => n
[field_id_16] => Black Leather
[field_id_47] => 00111443
[cp_call] => 1
[channel_id] => 2
[site_id] => 1
[ping_servers] => Array
(
)
)Have i missed something which is causing this to fall down?
(Yes I have checked that the custom field id’s are correct)
Moved to Development and Programming by Moderator
Just updated the code slightly, still erroring
Array
(
[author_id] => 1
[title] => Desert Boot
[url_title] => Desert-Boot---
[entry_date] => 1295867744
[versioning_enabled] => n
[year] => 2011
[month] => 01
[day] => 24
[expiration_date] =>
[comment_expiration_date] =>
[status] => open
[allow_comments] => n
[field_id_16] => Black Leather
[field_ft_16] => none
[field_id_47] => 00111443
[field_ft_47] => none
[cp_call] => 1
[channel_id] => 2
[site_id] => 1
[ping_servers] => Array
(
)
)N.B: included field_ft_16 and field_ft_47 set to ‘none’
This is how I run the channel entry API:
$this->EE->load->library('api');
$this->EE->api->instantiate('channel_fields');
$this->EE->api_channel_fields->fetch_custom_channel_fields();
$this->EE->api->instantiate('channel_entries');
$this->EE->api_channel_fields->settings = array();
$data = array(
'title' => 'A test entry',
'entry_date' => '1256953732',
'field_id_1' => 'Testing',
'field_ft_1' => 'xhtml'
);Andrew
Yes- for the next release the api has been tweaked a bit, and the documentation will reflect that (a bit different from what you’ve done- but gist is same- make sure settings is properly populated). Thanks for the heads up- and sorry this one hung you up. Do double check the docs in the next release, as the changes affect some other issues that may crop up.
Can someone post a definitive answer on how to use (or if we can successfully use) the Channel Entries API in EE 2.1.3? Or update the docs with a complete example usage? I simply can’t get new entries inserted without errors. After tweaking line 941 per a bug report in another thread, my entries are getting added, but this error (notice) is still cropping up:
Severity: Notice
Message: Undefined index: field_fmt
Filename: api/Api_channel_entries.php
Line Number: 944ExpressionEngine 2.1.3 build 20101220
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.