Re: REST API doesn't work for me

Michael C. Jaeger
 

Hello,

I quickly tried it (on macosx), I think with the latest docker image it works (REST API is accessible).

Kind regards, Michael

lando:~ sam$ sudo docker run -d -p 8081:80 fossology/fossology:latest
Password:
Unable to find image 'fossology/fossology:latest' locally
latest: Pulling from fossology/fossology
fc7181108d40: Pull complete
fb9e0270a85b: Pull complete
e94890eadc8c: Pull complete
217106126024: Pull complete
d492da851f3c: Pull complete
41664bf0483f: Pull complete
ebc0022e3578: Pull complete
b1cdf126c91b: Pull complete
42723fb53ecc: Pull complete
900bf51529a3: Pull complete
bbe082eb7cc2: Pull complete
8aca2ecbf237: Pull complete
f24b9d7f3128: Pull complete
Digest: sha256:433a0e748cb1b1614189d37213373ea1fe51135a446a85705884c82436f648b9
Status: Downloaded newer image for fossology/fossology:latest
13c22e8d0816945123ade4c88d40a4422a44465e8bcb55d45eb3cb974e7dcf55
lando:~ sam$ 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"}

On 12. Jul 2019, at 02:02, leimaohui <leimaohui@...> wrote:

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.