Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

API call returns HT...
 
Notifications
Clear all

API call returns HTML content instead of data

7 Posts
2 Users
0 Reactions
3,068 Views
(@mazama)
Posts: 11
Active Member
Topic starter
 
[#9329]

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

 
 

 

 
 
 
 
   
 
 
    ProjeQtOr
 
 
  var isNewGui=true;
  dojo.addOnLoad(function(){
          changeTheme('ProjeQtOrFlatGrey ProjeQtOrNewGui');
            setColorTheming('#3e5876','#ef4227');
            });
    function autoRedirect() {
      window.setTimeout("document.getElementById('indexForm').submit()",10);
    }
 

 

   
 

 

   

   

   

     

   

 

       

                                                           

                            

                           

                                     

           

         

         

           

         

       

                              

                                

                                       

                                

                              

                            

                               

                                 

                                       
                                 

                               

           

             

               
                 
                 
                 
                  (function() {
                    dojo.byId('currentWidth').value= screen.width;
                    })();
                 
               
             

           

       

     

Thanks already for the support.


 
Posted : 20 Feb 2024 13H09
babynus
(@babynus)
Posts: 14966
Main Contributor Admin
 

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


 
Posted : 20 Feb 2024 18H39
(@mazama)
Posts: 11
Active Member
Topic starter
 

I copied the .htaccess file from the api folder to /var/www/projeqtor. Its content is

  RewriteEngine On

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

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 : 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 : 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 : 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 : granted


 
Posted : 22 Feb 2024 12H15
babynus
(@babynus)
Posts: 14966
Main Contributor Admin
 

When you call the API, you must provide a valid user account (with basic authent) as provided in .htPasswd file.


 
Posted : 22 Feb 2024 12H27
(@mazama)
Posts: 11
Active Member
Topic starter
 

Yes, the username and password were defined in the .htpasswd using the htpasswd command and they match an admin user defined in ProjeQtor.


 
Posted : 22 Feb 2024 12H30
babynus
(@babynus)
Posts: 14966
Main Contributor Admin
 

Possible, 
but you have to provide this on the API call.


 
Posted : 22 Feb 2024 13H13
(@mazama)
Posts: 11
Active Member
Topic starter
 

Isn't this done in the PHP code ? I pasted it in my first message.


 
Posted : 22 Feb 2024 13H26
Share:

Scroll to Top