error with integration

Humberto Baruch Olguin Lesdesma baruch_001 at outlook.es
Fri Sep 29 02:00:16 UTC 2023


I'm sharing my function for making a GET request to the Bugzilla API. However, the response only provides an HTML code and not the expected format as outlined in the documentation. Could you please advise on potential issues and how to rectify them? Additionally, I would like to inquire about the process for a POST method.

Use Adonis.js
const baseUrl = `http://localhost/bugzilla/rest/bug/`

            const user = 'baruch_001 at outlook.es';
            const password = my_password;

            await axios.get(baseUrl, {
                auth: {
                    username: usuario,
                    password: contraseña
                }
            })
                .then(response => {
                    if (response.status === 200) {
                        const bugData = response.data;
                       console.log(bugData);
                    } else {
                        console.error(`Error: ${response.status}`);
                    }
                })
                .catch(error => {
                    console.error('Error:', error);
                });

Response:
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Error</title>

      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<link href="data/assets/2f5735cf3abd04bddc8e363a8613a9f5.css" rel="stylesheet" type="text/css">




<script type="text/javascript" src="data/assets/1b4e898422a669ab82b604a2c23edce5.js"></script>

    <script type="text/javascript">
    <!--
        YAHOO.namespace('bugzilla');
        YAHOO.util.Event.addListener = function (el, sType, fn, obj, overrideContext) {
               if ( ("onpagehide" in window || YAHOO.env.ua.gecko) && sType === "unload") { sType = "pagehide"; };
               var capture = ((sType == "focusin" || sType == "focusout") && !YAHOO.env.ua.ie) ? true : false;
               return this._addListener(el, this._getType(sType), fn, obj, overrideContext, capture);
         };
        if ( "onpagehide" in window || YAHOO.env.ua.gecko) {
            YAHOO.util.Event._simpleRemove(window, "unload",
                                           YAHOO.util.Event._unload);
        }

        function unhide_language_selector() {
            YAHOO.util.Dom.removeClass(
                'lang_links_container', 'bz_default_hidden'
            );
        }
        YAHOO.util.Event.onDOMReady(unhide_language_selector);


        var BUGZILLA = {
            param: {
                cookiepath: '\/',
                maxusermatches: 1000
            },
            constant: {
                COMMENT_COLS: 80
            },
            string: {


                attach_desc_required:
                    "You must enter a Description for this attachment.",
                component_required:
                    "You must select a Component for this bug.",
                description_required:
                    "You must enter a Description for this bug.",
                short_desc_required:
                    "You must enter a Summary for this bug.",
                version_required:
                    "You must select a Version for this bug."
            }
        };

    // -->
    </script>
<script type="text/javascript" src="data/assets/d41d8cd98f00b204e9800998ecf8427e.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
                       title="Bugzilla" href="./search_plugin.cgi">
    <link rel="shortcut icon" href="images/favicon.ico">
  </head>

  <body
        class="localhost-bugzilla yui-skin-sam">

  <div id="header"><div id="banner">
  </div>

    <div id="titles">
      <span id="title">Bugzilla – Error</span>
    </div>
    <div id="common_links"><ul class="links">
  <li><a href="./">Home</a></li>
  <li><span class="separator">| </span><a href="enter_bug.cgi">New</a></li>
  <li><span class="separator">| </span><a href="describecomponents.cgi">Browse</a></li>
  <li><span class="separator">| </span><a href="query.cgi">Search</a></li>

  <li class="form">
    <span class="separator">| </span>
    <form action="buglist.cgi" method="get"
        onsubmit="if (this.quicksearch.value == '')
                  { alert('Please enter one or more search terms first.');
                    return false; } return true;">
    <input type="hidden" id="no_redirect_top" name="no_redirect" value="0">
    <script type="text/javascript">
      if (history && history.replaceState) {
        var no_redirect = document.getElementById("no_redirect_top");
        no_redirect.value = 1;
      }
    </script>
    <input class="txt" type="text" id="quicksearch_top" name="quicksearch"
           title="Quick Search" value="">
    <input class="btn" type="submit" value="Search"
           id="find_top"></form>
  <a href="page.cgi?id=quicksearch.html" title="Quicksearch Help">[?]</a></li>

  <li><span class="separator">| </span><a href="report.cgi">Reports</a></li>

  <li></li>
      <li id="new_account_container_top">
        <span class="separator">| </span>
        <a href="createaccount.cgi">New Account</a>
      </li>

    <li id="mini_login_container_top">
  <span class="separator">| </span>
  <a id="login_link_top" href="rest?GoAheadAndLogIn=1"
     onclick="return show_mini_login_form('_top')">Log In</a>

  <form action="rest" method="POST"
        class="mini_login bz_default_hidden"
        id="mini_login_top">
    <input id="Bugzilla_login_top" required
           name="Bugzilla_login" class="bz_login"
        type="email" placeholder="Email Address">
    <input class="bz_password" name="Bugzilla_password" type="password"
           id="Bugzilla_password_top" required
           placeholder="Password">
    <input type="hidden" name="Bugzilla_login_token"
           value="">
    <input type="submit" name="GoAheadAndLogIn" value="Log in"
            id="log_in_top">
    <a href="#" onclick="return hide_mini_login_form('_top')">[x]</a>
  </form>
</li>


  <li id="forgot_container_top">
    <span class="separator">| </span>
    <a id="forgot_link_top" href="rest?GoAheadAndLogIn=1#forgot"
       onclick="return show_forgot_form('_top')">Forgot Password</a>
    <form action="token.cgi" method="post" id="forgot_form_top"
          class="mini_forgot bz_default_hidden">
      <label for="login_top">Login:</label>
      <input name="loginname" size="20" id="login_top" required
          type="email" placeholder="Your Email Address">
      <input id="forgot_button_top" value="Reset Password" type="submit">
      <input type="hidden" name="a" value="reqpw">
      <input type="hidden" id="token_top" name="token"
             value="1695951637-0JUfFUYnFYxFqnY8TzMtXGfvnNA-Pcqhv-3yw9CYBEQ">
      <a href="#" onclick="return hide_forgot_form('_top')">[x]</a>
    </form>
  </li>
</ul>
    </div>
  </div>

  <div id="bugzilla-body">
<div id="error_msg" class="throw_error">
    The REST Interface feature is not
    available in this Bugzilla.

</div>

<p id="post_err_msg">
  Please press <b>Back</b> and try again.
</p>
</div>

    <div id="footer">
      <div class="intro"></div>
<ul id="useful-links">
  <li id="links-actions"><ul class="links">
  <li><a href="./">Home</a></li>
  <li><span class="separator">| </span><a href="enter_bug.cgi">New</a></li>
  <li><span class="separator">| </span><a href="describecomponents.cgi">Browse</a></li>
  <li><span class="separator">| </span><a href="query.cgi">Search</a></li>

  <li class="form">
    <span class="separator">| </span>
    <form action="buglist.cgi" method="get"
        onsubmit="if (this.quicksearch.value == '')
                  { alert('Please enter one or more search terms first.');
                    return false; } return true;">
    <input type="hidden" id="no_redirect_bottom" name="no_redirect" value="0">
    <script type="text/javascript">
      if (history && history.replaceState) {
        var no_redirect = document.getElementById("no_redirect_bottom");
        no_redirect.value = 1;
      }
    </script>
    <input class="txt" type="text" id="quicksearch_bottom" name="quicksearch"
           title="Quick Search" value="">
    <input class="btn" type="submit" value="Search"
           id="find_bottom"></form>
  <a href="page.cgi?id=quicksearch.html" title="Quicksearch Help">[?]</a></li>

  <li><span class="separator">| </span><a href="report.cgi">Reports</a></li>

  <li></li>
      <li id="new_account_container_bottom">
        <span class="separator">| </span>
        <a href="createaccount.cgi">New Account</a>
      </li>

    <li id="mini_login_container_bottom">
  <span class="separator">| </span>
  <a id="login_link_bottom" href="rest?GoAheadAndLogIn=1"
     onclick="return show_mini_login_form('_bottom')">Log In</a>

  <form action="rest" method="POST"
        class="mini_login bz_default_hidden"
        id="mini_login_bottom">
    <input id="Bugzilla_login_bottom" required
           name="Bugzilla_login" class="bz_login"
        type="email" placeholder="Email Address">
    <input class="bz_password" name="Bugzilla_password" type="password"
           id="Bugzilla_password_bottom" required
           placeholder="Password">
    <input type="hidden" name="Bugzilla_login_token"
           value="">
    <input type="submit" name="GoAheadAndLogIn" value="Log in"
            id="log_in_bottom">
    <a href="#" onclick="return hide_mini_login_form('_bottom')">[x]</a>
  </form>
</li>
  <li id="forgot_container_bottom">
    <span class="separator">| </span>
    <a id="forgot_link_bottom" href="rest?GoAheadAndLogIn=1#forgot"
       onclick="return show_forgot_form('_bottom')">Forgot Password</a>
    <form action="token.cgi" method="post" id="forgot_form_bottom"
          class="mini_forgot bz_default_hidden">
      <label for="login_bottom">Login:</label>
      <input name="loginname" size="20" id="login_bottom" required
          type="email" placeholder="Your Email Address">
      <input id="forgot_button_bottom" value="Reset Password" type="submit">
      <input type="hidden" name="a" value="reqpw">
      <input type="hidden" id="token_bottom" name="token"
             value="1695951637-0JUfFUYnFYxFqnY8TzMtXGfvnNA-Pcqhv-3yw9CYBEQ">
      <a href="#" onclick="return hide_forgot_form('_bottom')">[x]</a>
    </form>
  </li>
</ul>
  </li>
</ul>

      <div class="outro"></div>
    </div>

  </body>
</html>
Enviado desde Correo<https://go.microsoft.com/fwlink/?LinkId=550986> para Windows

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bugzilla.org/pipermail/support-list/attachments/20230929/8a392fea/attachment-0001.html>


More information about the support-list mailing list