Hi Anaish,
You may use esri.geometry.Polygon.getExtent() method to get the extent of a polygon. Here is its documentation:
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/polygon.htm#getExtent
Hi swingley, thanks for the reply. I can't use static json files because the geometries in my web application are dynamic (i.e they can be added in an adhoc manner).
@hzhu that still brings all the geometries across the wire, which is what OP is trying to avoid.
@hzhu As you request more features (using either esri.request or a queryTask), the response size will grow. If the server only returned the extent of the features that satisfy a request, then the response size will be consistent if you ask for 10 or 1000 features. To my knowledge, there's not an out of the box way to get just a bounding box for features that satisfy a request w/o sending all of the geometries to the client.
How is the return value of esri.request different than a queryTask? The JavaScript syntax for working with them differs but both fetch plain text from the server (you can verify this via firebug or chrome's dev tools) that is then turned into JavaScript objects on the client.