HackerRank

БЕЗКОШТОВНО
(Ким) hackerrank | Оновлено 2 months ago | Tools
Популярність

5.2 / 10

Затримки

638ms

Рівень обслуговування

100%

Health Check

N/A

Повернутися до всіх обговорень

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

Rapid account: Masterjavamayank
masterjavamayank
7 years ago

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

Приєднуйтесь до обговорення — додайте повідомлення нижче:

Вхід / Реєстрація, щоб публікувати нові повідомлення