View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - API call returns HTML content instead of data - ProjeQtOr
 
 

API call returns HTML content instead of data

More
20 Feb 2024 11:09 - 20 Feb 2024 11:10 #1 by mazama
Hello,

I followed the documentation to get the API running, but an example call returns an HTML page instead of the expected data.

My PHP code is

<?php 
$fullUrl = "http://localhost:3000/api/Ticket/list/all";
$username = "my_username";
$password = "my_password";
 $curl = curl_init($fullUrl);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$curl_response = curl_exec($curl);
 echo $curl_response;
curl_close($curl); 
?> 

And the answer from ProjeQtOr is

<!DOCTYPE html>
<html style="margin: 0px; padding: 0px;">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

  <meta http-equiv="X-UA-Compatible" content="IE=edge" />

  <link rel="shortcut icon" href="view/img/logo.ico" type="image/x-icon" />
  <link rel="icon" href="view/img/logo.ico" type="image/x-icon" />
  <link rel="stylesheet" type="text/css" href="view/css/projeqtor.css" />
  <link rel="stylesheet" type="text/css" href="view/css/projeqtorFlat.css" />
    <link rel="stylesheet" type="text/css" href="view/css/projeqtorNew.css" />
  <script type="text/javascript" src="view/js/dynamicCss.js?version=V11.0.2.0344" ></script>
  <script type="text/javascript" src="view/js/projeqtor.js?version=V11.0.2.0344" ></script>
    <title>ProjeQtOr</title>
  <script type="text/javascript" src="external/dojo/dojo.js"
    djConfig='parseOnLoad: false,
              isDebug: false'></script>
  <script language="javascript">
  var isNewGui=true;
  dojo.addOnLoad(function(){
          changeTheme('ProjeQtOrFlatGrey ProjeQtOrNewGui');
            setColorTheming('#3e5876','#ef4227');
            });
    function autoRedirect() {
      window.setTimeout("document.getElementById('indexForm').submit()",10);
    }
  </script>
</head>

<body id="body" class="nonMobile tundra  ProjeQtOrFlatGrey ProjeQtOrNewGui"  style="background-color:#3e5876 !important;" onload="autoRedirect();">
  <div id="wait">
   
  </div>
  <div style="position:absolute;margin-top:-50%;margin-left:-0%;width:250%;height:250%;opacity:0.1 !important;z-index:-2;" class="loginBackgroundNewGui"></div>    <div style="position:absolute;width:100%;height:100%;opacity:0.6 !important;z-index:-1;" class="loginBackgroundNewGui"></div>    <table align="center" width="100%" height="100%" class="">
    <tr height="100%">
      <td width="100%" align="center">
        <table  align="center" >
                                                            <tr style="height:42px;" >
                             <td align="center" style="position:relative;height: 1%;" valign="center">
                               <div style="position:relative;height:75px;">
                                 <div class="divLoginIconDrawing" style="position:absolute;background-color:#3e5876";>
                                        <div class="divLoginIconBig"></div>
                                 </div>
                               </div>
                             </td>
                            </tr>
                                      <tr style="height:10px;" >
            <td align="left" style="height: 1%;" valign="top">
                                <div style="position:relative;width: 400px; height: 54px;">
                                  <div style="z-index:10;overflow:visible;position:absolute;width: 480px; height: 280px;top:15px;text-align: center">
                                        <img style="max-height:60px" src="view/img/titleSmall.png" />
                                  </div>
                                </div>
            </td>
          </tr>
          <tr style="height:100%" height="100%">
            <td style="height:99%" align="left" valign="middle">
              <div  id="formDivIndex" dojoType="dijit.layout.ContentPane" region="center" style="width: 470px; height:210px;overflow:hidden">
                <form id="indexForm" name="indexForm" action="view/index.php" method="post" target="_top">
                  <input type="hidden" id="xcurrentLocale" name="xcurrentLocale" value="en" />
                  <input type="hidden" id="currentWidth" name="currentWidth" value="" />
                  <script>
                  (function() {
                    dojo.byId('currentWidth').value= screen.width;
                    })();
                  </script>
                </form>
              </div>
            </td>
          </tr>
        </table>
        </div>
      </td>
    </tr>
  </table>

</body>

</html>

Thanks already for the support.
Last edit: 20 Feb 2024 11:10 by mazama.

Please Log in or Create an account to join the conversation.

More
20 Feb 2024 16:39 - 20 Feb 2024 16:40 #2 by babynus
It seems the .htAccess is not applied as defined in the api folder.
Note that if you use NGINX, you'll have to add the features in the virtualhost

Babynus
Administrator of ProjeQtOr web site
Last edit: 20 Feb 2024 16:40 by babynus.

Please Log in or Create an account to join the conversation.

More
22 Feb 2024 10:15 #3 by mazama
I copied the .htaccess file from the api folder to /var/www/projeqtor. Its content is

<IfModule mod_rewrite.c>
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?uri=$1
</IfModule>


AuthUserFile "./.htpasswd"
AuthName "ProjeQtOr"
AuthType Basic
require valid-user 


Here are the error logs from Apache when the requests is performed, I'm not too sure wht it means :

[Thu Feb 22 10:10:46.486813 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of Require valid-user : denied (no authenticated user yet)
[Thu Feb 22 10:10:46.486835 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of <RequireAny>: denied (no authenticated user yet)
[Thu Feb 22 10:10:46.486949 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of Require valid-user : granted
[Thu Feb 22 10:10:46.486950 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of <RequireAny>: granted
[Thu Feb 22 10:10:46.487001 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of Require valid-user : denied (no authenticated user yet)
[Thu Feb 22 10:10:46.487003 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of <RequireAny>: denied (no authenticated user yet)
[Thu Feb 22 10:10:46.487108 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of Require valid-user : granted
[Thu Feb 22 10:10:46.487109 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of <RequireAny>: granted

Please Log in or Create an account to join the conversation.

More
22 Feb 2024 10:27 #4 by babynus
When you call the API, you must provide a valid user account (with basic authent) as provided in .htPasswd file.

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
22 Feb 2024 10:30 #5 by mazama
Yes, the username and password were defined in the .htpasswd using the htpasswd command and they match an admin user defined in ProjeQtor.

Please Log in or Create an account to join the conversation.

More
22 Feb 2024 11:13 #6 by babynus
Possible, 
but you have to provide this on the API call.

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.043 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.