REST2 problem, 404 URL not found


#1

Hello

I installed rt-extension-rest2 like it is written on git. I do not see any error in syslog.
In RT i can see i have this two plugins enbled:

Plugins [
‘RT::Extension::REST2’,
‘RT::Authen::Token’
]

Token plugin work ok, as token is generated. But problem is with REST2 module.

when I try to do this with my url I get not found from RT.
curl -H ‘Authorization: token XX_TOKEN_XX’ ‘XX_RT_URL_XX/REST/2.0/queues/all’

How to debug this further why this is not working in my case. I have added Plugin(‘RT::Extension::REST2’); to RT_SiteConfig.pm.

I am using Debian in RT was installed from repo. Token and REST2 api were compiled from source.

br
miha


#2

Do you see any errors in the web server logs? Did you clear the Mason cache and restart the web server?


#3

Hello

yes, i cleared the cache. I noticed that my link was wrong, i did not use “rt” part. So now I am calling like: “http://xxx.xxx.xxx.xxx/rt/REST/2.0/queues/all” but I get 500, internal server error.

I do not see anything in syslog and there is nothing in log folder for rt.


#4

One thing, when i cleared chacke i need to add permisson to www-data to obj folder.

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
    <head>
        <title>500 Internal Server Error</title>
    </head>
    <body>
        <h1>Internal Server Error</h1>
        <p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
        <p>Please contact the server administrator at 
 webmaster@localhost to inform them of the time this error occurred,
 and the actions you performed just before this error.</p>
        <p>More information about this error may be available
in the server error log.</p>
        <hr>
        <address>Apache/2.4.25 (Debian) Server at xxx.xxx.xxx.xxx Port 80</address>
    </body>
</html>

Another thing. I noticed in obj folder, that only ls
“plugin-RT::Authen::Token” and “standard” are created. I not not see anything that could be indecation REST2. Plug in added to config file and i have look again in syslog if anything pops out when apache2 is restarted. I do not see any error.

Only this: Any::Moose is deprecated. Please use Moo instead at /usr/local/share/perl/5.24.1/Path/Dispatcher/Rule.pm line 2.


#5

Hi

You need to check the web server logs, not syslog or RT’s log

regards
Garry


#6

Hi

thank you. @G.Booth i get this: Undefined subroutine &Path::Dispatcher::blessed called at /usr/local/share/perl/5.24.1/Path/Dispatcher.pm line 65.\n


#7

blessed() should be coming from Scalar::Util which is included in the 6th line of RT::Extension::REST2::Util (not to mention lots of other places in RT), so that’s an odd error.

If you go to (in a normal web browser):

http://xxx.xxx.xxx.xxx/REST/2.0

or

http://xxx.xxx.xxx.xxx/rt/REST/2.0

(depending on what your RT config’s WebPath and WebBaseURL settings actually are) do you get the help documentation for the REST 2.0 extension appearing?

If you don’t get anything appearing, find your local/plugins/RT-Extension-REST2/lib/RT/Extension directory and in Dispatcher.pm add the line:

use Scalar::Util qw( blessed );

after the use warnings; line (after line 3 according to my copy of the code). That should ensure that Scalar::Util's blessed() subroutine is available before Path::Dispatcher is called.


#8

Hi @GreenJimll.

I did what you suggested but it is the same. for PATH/REST/2.0 ( for this one is 404 no found )or PATH/RT/REST/2.0 (here is “Internal Server Error” ).

Edited “vim /usr/local/share/request-tracker4/plugins/RT-Extension-REST2/lib/RT/Extension/REST2/Dispatcher.pm”

Now i have like:

package
use strict;
use warnings;
use Scalar::Unit qw( blessed );


#9

Did you clear the Mason cache and restart the web server after putting that line in? You need to do that after any change to RT code (sorry - I should have been more explicit - I’m just used to doing all the time).


#10

yes, but it is the same :frowning:
is it normal that i have to add persmision to www-data to obj dir every time whay i do that?


#11

Nope - I just installed a fresh RT install on my desktop Debian machine to check (as we use a different Linux distro for our production services) and I can blow away /opt/rt4/var/mason_data/obj and it just recreates it when I restart the web front end. I should note that /opt/rt4/var/mason_data directory is owned by www-data which is why it can regenerate the obj directory OK.


#12

Hi

i am getting the same :frowning:

Undefined subroutine &Path::Dispatcher::blessed called at /usr/local/share/perl/5.24.1/Path/Dispatcher.pm line 65.\n

reinstalling from source could fix this?


#13

OK, i manage to get it working.

I have now response from /rt/REST/2.0/ :slight_smile:

The url that i have to edit was:
/usr/local/share/perl/5.24.1/Path/Dispatcher.pm