Implemented 'add-segment' API call.