How can I get a JSON response to a submitJob operation using Java?

2587
1
Jump to solution
12-02-2013 07:55 AM
ab1
by
Occasional Contributor II
Hello,

I'm trying to get the JSON response of the submitJob operation launched by a restful call: http://<gp-task-url>/submitJob.
I'm using Java7.

The response I'm getting is an HTML response, using the code below:

URL url = new URL("http://<gp-task-url>/submitJob");     HttpURLConnection connection = (HttpURLConnection) url    .openConnection();  connection.setRequestProperty("Content-Type", "application/json");   connection.setRequestMethod("GET");    InputStream is = connection.getInputStream();

   

Do you have any idea on how to retrieve a JSON response?

Thanks.
0 Kudos
1 Solution

Accepted Solutions
ab1
by
Occasional Contributor II
The answer is to append ?f=pjson to the end of the URL.

View solution in original post

0 Kudos
1 Reply
ab1
by
Occasional Contributor II
The answer is to append ?f=pjson to the end of the URL.
0 Kudos