Maps API - Get Directions

Is there a way to get directions using the maps API? Something like this:

From: New York, NY
To: Chicago, IL

or:

From 40.712882, -73.967257
To: 41.943181,-87.770677 [import]uid: 8556 topic_id: 6731 reply_id: 306731[/import]