Implemented the segments API endpoint.