HackerRank

GRATUITO
Por hackerrank | Atualizado 2 месяца назад | Tools
Popularidade

5.2 / 10

Latência

638ms

Nível de serviço

100%

Health Check

N/A

Voltar para todas as discussões

I am not able to do request on hackerrank api for code submission .

Rapid account: Masterjavamayank
masterjavamayank
7 лет назад

Test Program code is …

public class HackerTest {

public static void main(String[] args) {
	try{
		
		
		String apiKey = "my api key";
		String source = "class Test{public static void main(String args[]){System.out.println(\"Hello!\");}}";
		
		
		source = URLEncoder.encode(source,"UTF-8");
		Integer lang = new Integer(3);
		
		String testcases = "[\"Hello!\"]";
		testcases = URLEncoder.encode(testcases,"UTF-8");
		String format = "json";
		String wait = "true";
		String l_response = null;
		
		Map<String,Object> l_input_map = new HashMap<String, Object>();
		l_input_map.put("source", String.valueOf(source));
		l_input_map.put("lang", String.valueOf(lang));
		l_input_map.put("testcases", String.valueOf(testcases));
		l_input_map.put("api_key", String.valueOf(apiKey));
		l_input_map.put("wait", String.valueOf(wait));
		l_input_map.put("callback_url", "");
		l_input_map.put("format",String.valueOf(format));
		
		HttpSender l_sender = new HttpSender();
		l_response = (String) l_sender.sendPost("http://api.hackerrank.com/checker/submission.json",l_input_map, null);
		System.out.println("Response : "+l_response);
		
				
	}catch(Exception ex){
		System.out.println("Exception : "+ex);
	}

}

}

Note - : HttpSender is my own class for requesting to api …That class is already in use for other api’s and working fine. Please check my above code.
Please help me out this problem.

Thanks
Mayank Gupta

Junte-se à discussão - adicione o comentário abaixo:

Efetue login / inscreva-se para postar novos comentários