Re: REST API doesn't work for me

leimaohui
 

Hi, Gaurav

Thank you for your reply. I will pull the latest image and try.


Best regards
Lei

-----Original Message-----
From: Mishra, Gaurav [mailto:@gmishx]
Sent: Thursday, July 11, 2019 4:24 PM
To: Lei, Maohui
Cc: fossology@...
Subject: RE: REST API doesn't work for me

Hello Lei,

I just tried running the exact same commands on my system and it seems to be
working fine.
------------------------------------------
$ curl -k -s -S -u fossy:fossy -X GET http://localhost:8081/repo/api/v1/folders
{"code":400,"message":"Authorization header is malformed or
empty.","type":"ERROR"}
------------------------------------------

Probably you are trying to running an old image. Can you please pull the latest
image again?

If it is still not working, I would suggest you to check if the following
settings are correct in your container:

File /etc/apache2/conf-enabled/fossology.conf should contain
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule "^api/(.*)" "/repo/api/index.php" [QSA,L]
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

And please check if the mod_rewrite is enabled in apache. You can check using
"a2query -m rewrite".
If the rewrite module is disabled, please enable it using "a2enmod rewrite" and
restart apache.

Hope this will help.

With best regards,
Gaurav Mishra

-----Original Message-----
From: fossology@... <fossology@...> On Behalf
Of leimaohui
Sent: 11 July 2019 13:23
To: fossology@...
Subject: [FOSSology] REST API doesn't work for me

Hi, all

I tried fossology REST API but failed. The following is my steps.

step1.Start the latest fossology docker.
--------------------------------------------
$ sudo docker run -d -p 8081:80 fossology/fossology:latest
390d501fec6e773340ff466c9876cf4d2155562748ed1e749d5457d490ad516e
$ sudo docker ps
CONTAINER ID IMAGE COMMAND
CREATED STATUS PORTS NAMES
390d501fec6e fossology/fossology:latest "/fossology/docker..." 18
seconds ago Up 4 seconds 0.0.0.0:8081->80/tcp focused_jepsen
--------------------------------------------

step2. Tried REST API, but failed.
--------------------------------------------
$ curl -k -s -S -u fossy:fossy -X GET
http://localhost:8081/repo/api/v1/folders
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /repo/api/v1/folders was not found on this server.</p> <hr>
<address>Apache/2.4.10 (Debian) Server at localhost Port 8081</address>
</body></html>
--------------------------------------------

I wonder if there is something error in my steps. Who can give me some
suggestions?

Best regard
Lei Maohui





Join fossology@lists.fossology.org to automatically receive all group messages.