Post operation in bugzilla using java code

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Post operation in bugzilla using java code

devteam
I am trying to post a data in Bugzilla through a java code by using the APIs of Bugzilla.
While running the code its getting an error code and mentioning need to login before accessing this part. I have tried to authenticate but that cannot be combined along with this post operation.

I am attaching the code :


public class Example{
public static String token;
//public static String api_key="**apikey**";
public static void main(String args[]) throws IOException {
   // String POST_PARAMS = "{\n" + "\"id\":10,\r\n" +
     //"\"version\":\"V1.1\"" + "\n}";

//String POST_PARAMS =  "{\"id\":10,\"version\":\"V1.1\"}";



   String urlString=null;

 urlString= "http://bug**lla.Example**.**/bugzilla/rest/login?login=usernbame&password=pwd";
   
        URL url = new URL(urlString);

        HttpURLConnection urlConnection= (HttpURLConnection) url.openConnection();
        urlConnection.setRequestProperty("Accept","application/json");
        urlConnection.setRequestMethod("GET");
   
        urlConnection.connect();
        System.out.println(urlString);
       BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));

    String line;

    while ((line = br.readLine()) != null)
             {
         
                System.out.println(line);                                
                                                       
                JSONObject jsonObject = new JSONObject(line);

                 //System.out.println(jsonObject.get("token"));
                 token = (String) jsonObject.get("token");    
                System.out.println("token:" +token);        
             }

   URL obj = new URL("http://bug*lla.Example**.**/bugzilla/rest/bug/?api_key="+api_key);
   System.out.println("link:"+obj);

    HttpURLConnection postConnection = (HttpURLConnection) obj.openConnection();
    postConnection.setDoOutput(true);  
    postConnection.setRequestMethod("PUT");
  //postConnection.setRequestProperty("username","api_key;**api*key123");
 
   postConnection.setRequestProperty("username","api_key;token");
    postConnection.setRequestProperty("Content-Type", "application/json");
    postConnection.setRequestProperty("charset", "utf-8");
   
   
    OutputStream os = postConnection.getOutputStream();
    os.write(POST_PARAMS.getBytes());
    os.flush();
    os.close();
    int responseCode = postConnection.getResponseCode();
    System.out.println("POST Response Code :  " + responseCode);
    System.out.println("POST Response Message : " + postConnection.getResponseMessage());
    if (responseCode == HttpURLConnection.HTTP_CREATED) { //success
        BufferedReader in = new BufferedReader(new InputStreamReader(
            postConnection.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in .readLine()) != null) {
            response.append(inputLine);
        } in .close();
        // print result
        System.out.println(response.toString());
    } else {
        System.out.println("POST NOT WORKED");
    }
}
}
_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

Re: Post operation in bugzilla using java code

sruthi.s
Bugzilla version is 5.0.4

I am using the following code but receiving the error 400 bad request. I have not been able to find out why it is not working.

In the PUT section I have only used JSON object as the request body.
The GET example using token and api_key are both working.

I have used username and password for the PUT request.
 Please find the code and error message bellow

import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Map;

public class Sample {
public static String token="xxxxxxxxxx";

    public static String result;


    public static void main(String args[]) {
String urlString1=null;
try {
     
            JSONObject data = new JSONObject();
       
            data.put("status", "IN_PROGRESS");

            URL url = new URL("http://bugzilla.testserver.com/bugzilla/rest/bug/14");
            HttpURLConnection httpConnection  = (HttpURLConnection) url.openConnection();
            httpConnection.setDoOutput(true);
            httpConnection.setRequestMethod("PUT");
            httpConnection.setRequestProperty("[hidden email]","pwd");
            httpConnection.setRequestProperty("Content-Type", "application/json");
            httpConnection.setRequestProperty("Accept", "application/json");
         
            DataOutputStream wr = new DataOutputStream(httpConnection.getOutputStream());
            wr.write(data.toString().getBytes());
            Integer responseCode = httpConnection.getResponseCode();

            BufferedReader bufferedReader;

            if (responseCode > 199 && responseCode < 300) {
                bufferedReader = new BufferedReader(new InputStreamReader(httpConnection.getInputStream()));
            } else {
                bufferedReader = new BufferedReader(new InputStreamReader(httpConnection.getErrorStream()));
            }

            StringBuilder content = new StringBuilder();
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                content.append(line).append("\n");
            }
            bufferedReader.close();

            System.out.println(content.toString());

        } catch (Exception e) {
            System.out.println("Error Message");
            System.out.println(e.getClass().getSimpleName());
            System.out.println(e.getMessage());
        }
    }

}

Error Message:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address>
</body></html>



On Saturday, January 12, 2019 at 2:18:35 PM UTC+5:30, Thorsten Schöning wrote:

> Guten Tag [hidden email],
> am Samstag, 12. Januar 2019 um 01:28 schrieben Sie:
>
> > I am trying to post a data in Bugzilla through a java code by using the APIs of Bugzilla.
>
> You should provide more details about the version of Bugzilla you are
> using, especially because the web-API changed in the latest major
> versions.
>
> > While running the code its getting an error code and mentioning
> > need to login before accessing this part. I have tried to
> > authenticate but that cannot be combined along with this post operation.
>
> Does your GET-example work and are you getting a token? Your
> PUT-example seems wrong to me, you are not providing a JSON-object as
> the one and only request body, but GET-parameters and HTTP-headers
> instead.
>
> > The REST API only supports JSON input, and either JSON or JSONP
> > output. So objects sent and received must be in JSON format.
>
> https://bugzilla.readthedocs.io/en/5.0/api/core/v1/general.html#basic-information
>
> You need to create some JSON-object containing all your data and PUT
> or POST that as the request body to the web service. No GET-params or
> additional headers. You can't combine username and API-key as well, so
> keep an I on that you have the individual values correct.
>
> https://bugzilla.readthedocs.io/en/5.0/api/core/v1/general.html#authentication
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning       E-Mail: [hidden email]
> AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
>
> Telefon...........05151-  9468- 55
> Fax...............05151-  9468- 88
> Mobil..............0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

Re: Post operation in bugzilla using java code

devteam
Thank you for the mail

> > httpConnection.setRequestProperty("[hidden email]","pwd");
The above statement is used for authentication.
 
If we remove that part from the code then , it shows an error:
{"documentation":"https://bugzilla.readthedocs.org/en/5.0/api/","error":true,"message":"You must log in before using this part of Bugzilla.","code":410}

If we use that part it shows another error as following:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address>
</body></html>

We did the packet capturing, following is the output;

*******************************
07:05:22.614926 IP (tos 0x0, ttl 105, id 26456, offset 0, flags [DF], proto TCP (6), length 285)
    xx.xx.xx.93.57573 > 10.1.0.5.http: Flags [P.], cksum 0xc53b (correct), seq 1:246, ack 1, win 259, length 245: HTTP, length: 245
        GET /bugzilla/rest/valid_login?login=[hidden email]&api_key=keyvalue HTTP/1.1
        Accept: application/json
        User-Agent: Java/1.8.0_121
        Host: host1.cloudplusinfotech.com
        Connection: keep-alive

07:05:22.614958 IP (tos 0x0, ttl 64, id 1840, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.0.5.http > xx.xx.xx.93.57573: Flags [.], cksum 0xf54c (incorrect -> 0x8a4d), ack 246, win 237, length 0
07:05:23.250185 IP (tos 0x0, ttl 64, id 1841, offset 0, flags [DF], proto TCP (6), length 513)
    10.1.0.5.http > xx.xx.xx.93.57573: Flags [P.], cksum 0xf725 (incorrect -> 0x0e3e), seq 1:474, ack 246, win 237, length 473: HTTP, length: 473
        HTTP/1.1 200 OK
        Date: Thu, 17 Jan 2019 07:05:22 GMT
        Server: Apache/2.4.7 (Ubuntu)
        X-xss-protection: 1; mode=block
        X-frame-options: SAMEORIGIN
        Access-control-allow-headers: origin, content-type, accept, x-requested-with
        X-content-type-options: nosniff
        Access-control-allow-origin: *
        Etag: 3UEGMp182VEiVeT1RV05tw
        Keep-Alive: timeout=5, max=100
        Connection: Keep-Alive
        Transfer-Encoding: chunked
        Content-Type: application/json; charset=UTF-8

        f
        {"result":true}
07:05:23.259441 IP (tos 0x0, ttl 64, id 1842, offset 0, flags [DF], proto TCP (6), length 45)
    10.1.0.5.http > xx.xx.xx.93.57573: Flags [P.], cksum 0xf551 (incorrect -> 0x444d), seq 474:479, ack 246, win 237, length 5: HTTP
07:05:23.479793 IP (tos 0x0, ttl 105, id 26457, offset 0, flags [DF], proto TCP (6), length 40)
    xx.xx.xx.93.57573 > 10.1.0.5.http: Flags [.], cksum 0x885b (correct), ack 479, win 257, length 0
07:05:23.497932 IP (tos 0x0, ttl 105, id 26458, offset 0, flags [DF], proto TCP (6), length 289)
    xx.xx.xx.93.57573 > 10.1.0.5.http: Flags [P.], cksum 0x3053 (correct), seq 246:495, ack 479, win 257, length 249: HTTP, length: 249
        PUT /bugzilla/rest/bug/14 HTTP/1.1
        [hidden email]: pwd
        Content-Type: application/json
        Accept: application/json
        User-Agent: Java/1.8.0_121
        Host: host1.cloudplusinfotech.com
        Connection: keep-alive
        Content-Length: 24

07:05:23.497947 IP (tos 0x0, ttl 64, id 1843, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.0.5.http > xx.xx.xx.93.57573: Flags [.], cksum 0xf54c (incorrect -> 0x876e), ack 495, win 245, length 0
07:05:23.498092 IP (tos 0x0, ttl 105, id 26459, offset 0, flags [DF], proto TCP (6), length 64)
    xx.xx.xx.93.57573 > 10.1.0.5.http: Flags [P.], cksum 0xc731 (correct), seq 495:519, ack 479, win 257, length 24: HTTP
07:05:23.498105 IP (tos 0x0, ttl 64, id 1844, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.0.5.http > xx.xx.xx.93.57573: Flags [.], cksum 0xf54c (incorrect -> 0x8756), ack 519, win 245, length 0
07:05:23.498287 IP (tos 0x0, ttl 64, id 1845, offset 0, flags [DF], proto TCP (6), length 521)
    10.1.0.5.http > xx.xx.xx.93.57573: Flags [P.], cksum 0xf72d (incorrect -> 0x5490), seq 479:960, ack 519, win 245, length 481: HTTP, length: 481
        HTTP/1.1 400 Bad Request
        Date: Thu, 17 Jan 2019 07:05:23 GMT
        Server: Apache/2.4.7 (Ubuntu)
        Content-Length: 300
        Connection: close
        Content-Type: text/html; charset=iso-8859-1

        <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
        <html><head>
        <title>400 Bad Request</title>
        </head><body>
        <h1>Bad Request</h1>
        <p>Your browser sent a request that this server could not understand.<br />
        </p>
        <hr>
        <address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address>
        </body></html>
07:05:23.498377 IP (tos 0x0, ttl 64, id 1846, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.0.5.http > xx.xx.xx.93.57573: Flags [F.], cksum 0xf54c (incorrect -> 0x8574), seq 960, ack 519, win 245, length 0
07:05:23.731174 IP (tos 0x0, ttl 104, id 26460, offset 0, flags [DF], proto TCP (6), length 40)
    xx.xx.xx.93.57573 > 10.1.0.5.http: Flags [F.], cksum 0x856a (correct), seq 519, ack 960, win 255, length 0
07:05:23.731196 IP (tos 0x0, ttl 64, id 1847, offset 0, flags [DF], proto TCP (6), length 40)
    10.1.0.5.http > xx.xx.xx.93.57573: Flags [.], cksum 0xf54c (incorrect -> 0x8573), ack 520, win 245, length 0
07:05:23.742355 IP (tos 0x0, ttl 104, id 26461, offset 0, flags [DF], proto TCP (6), length 40)
    xx.xx.xx.93.57573 > 10.1.0.5.http: Flags [.], cksum 0x8569 (correct), ack 961, win 255, length 0
*********************




On Tuesday, January 15, 2019 at 2:51:31 PM UTC+5:30, Thorsten Schöning wrote:

> Guten Tag [hidden email],
> am Dienstag, 15. Januar 2019 um 09:51 schrieben Sie:
>
> > I am using the following code but receiving the error 400 bad
> > request. I have not been able to find out why it is not working.
>
> Use Wireshark or such to have a look at the request you actually send,
> it might still really be wrong for some reason. For example, all
> examples I find are closing the OutputStream after writing data to it,
> which you don't seem to do. It might be that your request is not
> properly formatted because of that, as HttpURLConnection can't know
> when your body is actually finished. Remember that HTTP-requests can
> be rendered differently chunked vs. non-chunked etc.
>
> https://stackoverflow.com/questions/20020902/android-httpurlconnection-how-to-set-post-data-in-http-body
> http://guruparang.blogspot.com/2016/01/example-on-working-with-json-and.html
>
> > httpConnection.setRequestProperty("[hidden email]","pwd");
>
> That is most likely wrong and might or might not harm.
>
> >             DataOutputStream wr = new
> > DataOutputStream(httpConnection.getOutputStream());
> >             wr.write(data.toString().getBytes());
> >             Integer responseCode = httpConnection.getResponseCode();
>
> No "wr.close()", which might or might not be wrong.
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning       E-Mail: [hidden email]
> AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
>
> Telefon...........05151-  9468- 55
> Fax...............05151-  9468- 88
> Mobil..............0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

Re: Post operation in bugzilla using java code

sruthi.s
Thank you Thorsten Schöning for your valuable suggestions. It helped us to solve the issues faced while submitting the PUT request to bugzilla.
The line regarding the header part (httpConnection.setRequestProperty("[hidden email]","pwd");) is removed from our earlier code as it is not used for authentication and we added api_key for authentication.
The working code is as follows:


import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONArray;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.*;
import java.util.Map;
import java.io.*;

public class Integupdate {
public static String id=12;
public static String data;
public static String v=V1.0;




    public static void main(String args[]) {

    data==  "{\"component\":\"branches\",\"platform\":\"PC\",\"product\":\"Example\",\"summary\":\"test21janchange4\",\"version\":\""+v+"\",\"op_sys\":\"Mac OS\" }";
       
        try {
           
            URL url1 = new URL("https://bugzilla.example.com/bugzilla/rest/bug/"+id+"?api_key=XXXXXXXXXXXXX");
           
           HttpURLConnection urlConnection= (HttpURLConnection) url1.openConnection();
            urlConnection.setRequestProperty("Accept","application/json");
            urlConnection.setRequestMethod("GET");
            urlConnection.connect();
            BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));        
            String line1;
            while ((line1 = br.readLine()) != null) {
         
                                           
                                                       
                JSONObject jsonObject = new JSONObject(line1);

                JSONArray jsonArray = jsonObject.getJSONArray("bugs");;

                for (int i = 0; i < jsonArray.length(); i++) {
                        JSONObject obj = jsonArray.getJSONObject(i);
}
   
}

URL url = new URL("https://bugzilla.example.com/bugzilla/rest/bug/"+id+"/comment?api_key=XXXXXXXXXXXXX");
            System.out.println(url);


            HttpURLConnection httpConnection  = (HttpURLConnection) url.openConnection();
            httpConnection.setDoOutput(true);
            httpConnection.setRequestMethod("POST");
         
            httpConnection.setRequestProperty("Content-Type", "application/json");
            httpConnection.setRequestProperty("Accept", "application/json");
       

            OutputStreamWriter wr = new OutputStreamWriter(httpConnection.getOutputStream());
            wr.write(data.toString());
            wr.close();

           Integer responseCode = httpConnection3.getResponseCode();
           BufferedReader bufferedReader;

         
            if (responseCode > 199 && responseCode < 300) {
                bufferedReader = new BufferedReader(new InputStreamReader(httpConnection.getInputStream()));
            } else {
                bufferedReader = new BufferedReader(new InputStreamReader(httpConnection.getErrorStream()));
            }

            // To receive the response
            StringBuilder content = new StringBuilder();
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                content.append(line).append("\n");
            }
            bufferedReader.close();

            // Prints the response
            System.out.println(content.toString());

        } catch (Exception e) {
            System.out.println("Error Message");
            System.out.println(e.getClass().getSimpleName());
            System.out.println(e.getMessage());
        }
    }

}







On Thursday, January 17, 2019 at 1:47:40 PM UTC+5:30, Thorsten Schöning wrote:

> Guten Tag [hidden email],
> am Donnerstag, 17. Januar 2019 um 08:15 schrieben Sie:
>
> >> > httpConnection.setRequestProperty("[hidden email]","pwd");
> > The above statement is used for authentication.
>
> I was just wondering because the docs don't seem to mention that one
> can set arbitrary request headers and Bugzilla will take them as
> username and password.
>
> https://bugzilla.readthedocs.io/en/5.0/api/core/v1/general.html#authentication
>
> > If we remove that part from the code then , it shows an error:
> > {"documentation":"https://bugzilla.readthedocs.org/en/5.0/api/","error":true,"message":"You
> > must log in before using this part of Bugzilla.","code":410}
>
> As your request is wrong anyway, that might simply be coincidence.
>
> > 07:05:23.497932 IP (tos 0x0, ttl 105, id 26458, offset 0, flags [DF], proto TCP (6), length 289)
> >     xx.xx.xx.93.57573 > 10.1.0.5.http: Flags [P.], cksum 0x3053
> > (correct), seq 246:495, ack 479, win 257, length 249: HTTP, length: 249
> >         PUT /bugzilla/rest/bug/14 HTTP/1.1
> >         [hidden email]: pwd
> >         Content-Type: application/json
> >         Accept: application/json
> >         User-Agent: Java/1.8.0_121
> >         Host: host1.cloudplusinfotech.com
> >         Connection: keep-alive
> >         Content-Length: 24
>
> > 07:05:23.497947 IP (tos 0x0, ttl 64, id 1843, offset 0, flags [DF], proto TCP (6), length 40)
> >     10.1.0.5.http > xx.xx.xx.93.57573: Flags [.], cksum 0xf54c
> [...]
>
> You didn't tell if you actually changed anything regarding closing the
> stream for the body or not.
>
> Looking at the captured request, I guess you didn't, because the body
> is missing. The formerly captured response contained a body
> ({"result":true}), so I don't think it's just missing from your
> provided output, but you really don't send it. 24 bytes would fit to a
> JSON object ({"status":"IN_PROGRESS"}), so I guess the request is
> simply not rendered entirely because you are not closing the stream
> containing the body.
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning       E-Mail: [hidden email]
> AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
>
> Telefon...........05151-  9468- 55
> Fax...............05151-  9468- 88
> Mobil..............0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

Re: Post operation in bugzilla using java code

sruthi.s
In reply to this post by devteam
At present the api_key is part of the url sent. Is there any way to send it in such a way that it is not a part of url specified in the code.






On Saturday, January 12, 2019 at 2:18:35 PM UTC+5:30, Thorsten Schöning wrote:

> Guten Tag [hidden email],
> am Samstag, 12. Januar 2019 um 01:28 schrieben Sie:
>
> > I am trying to post a data in Bugzilla through a java code by using the APIs of Bugzilla.
>
> You should provide more details about the version of Bugzilla you are
> using, especially because the web-API changed in the latest major
> versions.
>
> > While running the code its getting an error code and mentioning
> > need to login before accessing this part. I have tried to
> > authenticate but that cannot be combined along with this post operation.
>
> Does your GET-example work and are you getting a token? Your
> PUT-example seems wrong to me, you are not providing a JSON-object as
> the one and only request body, but GET-parameters and HTTP-headers
> instead.
>
> > The REST API only supports JSON input, and either JSON or JSONP
> > output. So objects sent and received must be in JSON format.
>
> https://bugzilla.readthedocs.io/en/5.0/api/core/v1/general.html#basic-information
>
> You need to create some JSON-object containing all your data and PUT
> or POST that as the request body to the web service. No GET-params or
> additional headers. You can't combine username and API-key as well, so
> keep an I on that you have the individual values correct.
>
> https://bugzilla.readthedocs.io/en/5.0/api/core/v1/general.html#authentication
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning       E-Mail: [hidden email]
> AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
>
> Telefon...........05151-  9468- 55
> Fax...............05151-  9468- 88
> Mobil..............0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

Re: Post operation in bugzilla using java code

sruthi.s
Hi Thorsten Schöning


Thank you so much for your help. We added the api_key to the data , now it is working as expected.

On Friday, February 1, 2019 at 9:47:14 PM UTC+5:30, Thorsten Schöning wrote:

> Guten Tag [hidden email],
> am Donnerstag, 31. Januar 2019 um 11:48 schrieben Sie:
>
> > At present the api_key is part of the url sent. Is there any way to
> > send it in such a way that it is not a part of url specified in the code.
>
> As the docs say, put it into "data" as all the other arguments for
> your calls.
>
> > You can specify Bugzilla_api_key or simply api_key as an argument to
> > any call[...]
>
> https://bugzilla.readthedocs.io/en/5.0/api/core/v1/general.html#authentication
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning       E-Mail: [hidden email]
> AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
>
> Telefon...........05151-  9468- 55
> Fax...............05151-  9468- 88
> Mobil..............0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.