public VoiceCallLeg viewCallLegByCallIdAndLegId ( final String callId , String legId ) throws UnsupportedEncodingException , NotFoundException , GeneralException , UnauthorizedException { if ( callId == null ) { throw new IllegalArgumentException ( "Voice call ID must be specified." ) ; } if ( legId == null ) { throw new IllegalArgumentException ( "Leg ID must be specified." ) ; } String url = String . format ( "%s%s/%s%s" , VOICE_CALLS_BASE_URL , VOICECALLSPATH , urlEncode ( callId ) , VOICELEGS_SUFFIX_PATH ) ; VoiceCallLegResponse response = messageBirdService . requestByID ( url , legId , VoiceCallLegResponse . class ) ; if ( response . getData ( ) . size ( ) == 1 ) { return response . getData ( ) . get ( 0 ) ; } else { throw new NotFoundException ( "No such leg" , new LinkedList < ErrorReport > ( ) ) ; } }
Retrieves a leg resource . The parameters are the unique ID of the call and of the leg that were returned upon their respective creation .