403 Forbidden Error

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

403 Forbidden Error

shane.trahan
I have spent countless hours trying to figure how to use the jsonrpc.cgi
service for Bugzilla 4.4.12 and cannot seem to get past this.  My ultimate
goal is to post new bugs into bugzilla using the jsonrpc.cgi webservice but
have just gotten nowhere..

After trying for sometime on my own installation I thought that perhaps my
installation was bad so I have tried on the landfill.bugzilla.org
installation and come up with the exact same error so there is something
wrong with the way that I am handling the submission or something..

In its simplest terms, I can properly use the service with "GET" and can
return the time and even users of the Bugzilla database but when I try to
"POST" to the jsonrpc.cgi I am stopped dead in my tracks..

Here is the code that I have
 <?php
  ob_start();
// Get cURL resource
$curl = curl_init();
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => '
https://landfill.bugzilla.org/bugzilla-4.4-branch/jsonrpc.cgi',
    CURLOPT_USERAGENT => 'Codular Sample cURL Request',
    CURLOPT_POST => 1,
    CURLOPT_HEADER =>1,
    CURLOPT_POSTFIELDS => array(
        Bugzilla_login => 'username',
        Bugzilla_password => 'password'

    )
));
// Send the request & save response to $resp
$response = curl_exec($curl);
  echo $response;
  ?>

The response is as follows
HTTP/1.1 100 Continue HTTP/1.1 403 Date: Fri, 21 Apr 2017 00:28:09 GMT
Server: Apache X-xss-protection: 1;
mode=block Strict-transport-security:
max-age=604800 X-frame-options: SAMEORIGIN X-content-type-options: nosniff
Set-Cookie: Bugzilla_login_request_cookie=fu3J3IC8TP;
path=/bugzilla-4.4-branch/; secure;
HttpOnly Transfer-Encoding: chunked Content-Type: application/json;
charset=UTF-8 No data.

Note that a Cookie Bugzilla_login_request_Cookie is returned so it appears
that something is getting through to the service regardless of the 403
 error.. even so, if I pass this cookie back to the jsonrpc.cgi as a cookie
header I still get a 403.

What am I doing wrong? It must be something silly that I am doing but I am
just stuck and need a push.

Any ideas or help would be greatly appreciated
_______________________________________________
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: 403 Forbidden Error

shane.trahan
If this cannot be done with jsonrpc.cgi.. Where are some good examples of the XMLRPC?
_______________________________________________
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: 403 Forbidden Error

shane.trahan
In reply to this post by shane.trahan
heh.. That was it.. that got me past the 403 error at least now I see error messages in the building of my JSON which is MUCH better than what I was seeing before.. Thank you so much.. I owe you a beer.. I figured it was something that I was missing..

For building the JSON,
I have
[{'Bugzilla_login': 'username','Bugzilla_password': 'password'}]
which is referenced at https://www.bugzilla.org/docs/4.4/en/html/api/Bugzilla/WebService.html#LOGGING_IN


Should it just be
[{'login': 'username','password': 'password'}] referenced at
https://www.bugzilla.org/docs/4.4/en/html/api/Bugzilla/WebService/User.html#Logging_In_and_Out

and these should be URL Encoded as well..
_______________________________________________
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: 403 Forbidden Error

shane.trahan
SOOOOO.. You did save my weekend :-)  Thank you so much.. I did get all this to work perfectly!! Thank you again.. I just had to add the Content Type Header and then the word "method" before by actual methods and everthing fell into place..

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