How can I plot polyline and zoom to it when using the direction api's response

After getting response from Directions api, I want to plot polyline and zoom to it. right now I am able to plot polyline for zoom – we are zooming mapview manually