cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1506
Views
0
Helpful
2
Replies

Not getting JOB details using rest api (Job Id provided)

dipuSourav
Level 1
Level 1

HI experts                             

 

I am following the below code in JAVA-

 

   URL url = new URL("http://<hostname:portname>/api/<DSP NAME>/method/Job/get/443083");

                               

                                HttpURLConnection conn = (HttpURLConnection) url.openConnection();

                                conn.setRequestMethod("GET");

                                conn.setDoInput(true);

                                conn.setDoOutput(true);

                                String userNamePassword = "<username>:<password>";

                                userNamePassword = new String(org.apache.commons.codec.binary.Base64.encodeBase64(userNamePassword.getBytes()));

                                conn.setRequestProperty("Authorization", userNamePassword);

                                conn.connect();

                                // System.out.println(conn.get);

                                BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));

                                String resp = "";

                                String next = null;

                                while ((next = reader.readLine()) != null)

                                                resp += next;

                                System.out.println(resp);

 

I am not getting the desired output(JOB details)

 

Please suggest me if I am missing something.

 

Regards

Sourav Chakraborty

1 Accepted Solution

Accepted Solutions

Robert Gardner
Cisco Employee
Cisco Employee

Try it this way

 

   URL url = new URL("http://<hostname:portname>/api/<DSP NAME>/Job.get/443083");

 

Note "method" is not used and there is a period between job and get not a slash

 

Bob Gardner

View solution in original post

2 Replies 2

Robert Gardner
Cisco Employee
Cisco Employee

Try it this way

 

   URL url = new URL("http://<hostname:portname>/api/<DSP NAME>/Job.get/443083");

 

Note "method" is not used and there is a period between job and get not a slash

 

Bob Gardner

Thanks Bob. :)