Sorry again about the confusion but I am actually trying to "Only show classes that are visible in the current map extent".
Ok, I think we're on the same page. If you add a REST service in ArcMap, you will notice in the Layout View, In the Legend properties, for the layers that are within the REST service, the box is grayed out for "Only show classes...".
Therefore, the only way you can do it through a web API is to have access to the actual data being served out by the REST service. Then, you will want to replace the REST service with similarly symbolized data using data accessible to your ArcGIS Server Instance. This will then do what you want. The issue is that you must have the actual data, instead of just the REST service.