Please explain getwork
Look at http://www.jsonrpc.org/specification: "An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]." To put it simply, it is really just an identifier for a message.
https://en.bitcoin.it/wiki/Block_hashing_algorithm
To put it simply, midstate is just the hashing done on the first half. We need the hash done on the whole data, but since the first part of the data doesn't change, we can just calculate it so that we don't have to perform full hashing everytime.
The target specifies the difficulty. Only a hash that is smaller than the target is accepted. In other words, you can also say that the target specifies the number of trailing zeroes required in the hash.
https://en.bitcoin.it/wiki/Getwork