Added segments API call and test

Change-Id: I4d1832353a8c9ddebc9649ab9c2eb49e8cfd8fac