HackerRank

免费
通过 hackerrank | 已更新 2ヶ月前 | Tools
人气

5.2 / 10

延迟

638ms

服务等级

100%

Health Check

N/A

返回所有讨论

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

加入讨论 - 在下面添加评论:

登录/注册以发布新的评论