Is it true that CCK has no API to work with from other modules? A colleague of mine was trying to import some huge data (from Excel) into a drupal 6 project with pure PHP and MySQL. The result is supposed to be few content-types(CCK), thousands of nodes(CCK nodes I mean),some vocabularies and few other things.

Seeing him trying to decipher the tables involved, I suggested instead of trying to reverse-engineer what CCK is doing, he should use CCK API. The problem is I couldn't find any such thing as CCK API!

Despite my heavy search to no avail, I can't in any right mind believe this to be true. I say, to myself, perhaps I can't find it ?

So how do you add a content-type, a CCK node etc etc Pragmatically ?
How do you utilize CCK in PHP code ? not from the user interface ?
No, it's not true.

CCK does its field processing when node API hooks are invoked, so when you (or another system process) call node_save(), CCK will run through the node object and save any field values it needs to. 

For example, this code would load a node, change the value of a field called field_my_field, and then save that to the database:

$node = node_load($nid);

$node-&gt;field_my_field[0] = array('value' =&gt; 'Some new value');

node_save($node);


There are also CRUD functions in includes/content.crud.inc which will come in handy to create fields and instances on the fly.