Please explain getwork Request:

POST / HTTP/1.1
Host: de.btcguild.com:8332
Accept: */*
Accept-Encoding: deflate, gzip
Content-type: application/json
X-Mining-Extensions: longpoll midstate rollntime submitold
Content-Length: 44
User-Agent: bfgminer 2.99.1

{"method": "getwork", "params": [], "id":0}


Response:

HTTP/1.1 200 OK
Server: nginx/0.7.65
Date: Sat, 13 Apr 2013 21:55:23 GMT
Content-Type: application/json;charset=ISO-8859-1
Connection: keep-alive
X-Long-Polling: /LP/
X-Blocknum: 105632
Content-Length: 607

{
"error": null,
"id": 0,
"result": {
"data": "00000002df54a70cd769d78b9605c0a6574638db799e86bdd1183cfc000001c2000000009e7ed0ae4ccdb1dbf283f4ab608791f21b1a5f437f405f4f9ba0bb3b693506a95169d43c1a022fbe00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000",
"hash1": "00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000",
"midstate": "24a747c3d16eadbc1481bd342b5558b2e235301c11353faf4bc25a384102c9c9",
"target": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000"
}
}



In the request/response what does id do?
In the response what is data and how is it generated?
What is midstate?
How does target work?
In the request what are these X-Mining-Extensions: longpoll midstate rollntime submitold parameters for?
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