Search code examples
bugzilla

Add bug to Bugzilla via code


I'm using browser-like approach for adding a bug to Bugzilla. I'm making a successful login. When I add the bug, I don't get error. I get status code OK. But, the response html contains this:

Bugzilla – Suspicious Action

"It looks like you didn't come from the right page (you have no valid token for the create_bug action while processing the 'post_bug.cgi' script). The reason could be one of: You clicked the "Back" button of your web browser after having successfully submitted changes, which is generally not a good idea (but harmless). You entered the URL in the address bar of your web browser directly, which should be safe. You clicked on a URL which redirected you here without your consent, in which case this action is much more critical. Are you sure you want to commit these changes anyway? This may result in unexpected and undesired results."

There is a confirm button.

When I do this by hand (not by code), I don't get the error page. Instead, I get response that everything went fine and I can get my bug's id. So, ahead in my code I'm using the id. However, because of the error I get, the id is an empty string. How to resolve this?

Can it be resolved by clicking on the confirm button by code?


Solution

  • You can use Bugzilla's REST API from your script.

    Creation of a bug is documented here