How could I have a plugin hook into when I edit or update a post? What I am trying to do is have my plugin know when I edit a post that is part of a particular section - let's call it "parts" - which then checks to see if a field is filled out in the form and then hits up an API and then pulls information from it and inserts it into empty fields in the entry.

So to clarify, here is a flow of what I'm looking to do:


I create an entry in the section "parts". 
Upon saving, it checks to see if the part number field is filled in.
If the field is filled in it will access an external json api and I'll pull a certain value (or in some cases multiple values) from the array.
I then want to have it fill in/update/replace the values in fields that I specify that are part of this entry. 


So essentially I am trying to figure out how to: Have my plugin trigger once an entry in a specific section is edited or added and then how I can (off of this trigger) have the plugin insert a value (or multiple values) into specific fields in the entry.
Craft has Hooks and Events which get invoked at different points in the core code. In your case the
entries.onBeforeSaveEntry event would be perfect.

Example:

public function init()
{
    parent::init();

    //Event: onBeforeSaveEntry
    craft()-&gt;on('entries.onBeforeSaveEntry', function(Event $event)
    {
        //Is the entry in the section 'parts'?
        if ($event-&gt;params['entry']-&gt;section == 'parts') {

            //Check if field is a number
            if (is_numeric($event-&gt;params['entry']-&gt;number_field_handle)) {
                //Do your JSON stuff

                //Replace values
                $event-&gt;params['entry']-&gt;getContent()-&gt;number_field_handle = 'something_else';
            }

        }
    });
}


The init() function goes into your Primary Plugin Class.