HackerRank

GRATUIT
Par hackerrank | Mise à jour 2ヶ月前 | Tools
Popularité

5.6 / 10

Latence

82ms

Niveau de service

100%

Health Check

N/A

Retour à toutes les discussions

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

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

Participez à la discussion - ajoutez un commentaire ci-dessous:

Connectez-vous / Inscrivez-vous pour publier de nouveaux commentaires