How to get Custom Metrics using WPT API

I want to programatically get the value for RUM First Paint or other customer metrics you display in detail via an API.

For example if you look at http://www.webpagetest.org/result/150217_5E_6KZ/1/details/ and say I want the values for primaryStart and primaryEnd, whats the best way?

Custom metrics are included in the API response. For example: http://www.webpagetest.org/result/150217_5E_6KZ/?f=json

You could get primaryStart one of two ways: data.runs[1].firstView[‘userTime.primaryStart’] or data.runs[1].firstView.userTimes.primaryStart