Help with Installing REST 2.0 API on Mac OSmojave

Hey,
So recently I’ve been tasked with developing a mobile application that makes calls from the REST API that RT has made available for its users and displays some of the information that our organization would like to keep track of.

As the REST 1.0 API didn’t support HTTP Authentication, I aimed to use the REST 2.0 API Extension instead and tried downloading it from Github (GitHub - bestpractical/rt-extension-rest2)
However, after I cloned the folder and tried to follow the terminal directions, I ran into a bit of a roadblock.

I input the perl command line (perl MakeFile.PL) and then the terminal gave me the following error:
Cannot find the location of RT.pm that defines $RT::LocalPath in: inc /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-

and directed me to input the path to my rt.pm file. I inputted the path of the rt.pm file as it had been laid out from the github download and my terminal rejected the file path.

After doing this 3 times, my terminal gave me the following error:
Caught an potential prompt infinite loop (inc/Module/Install/RTx.pm|60|Path to directory containing your RT.pm:) at inc/Module/Install/Makefile.pm line 25, line 3.

Does anyone have any tips on how to get past this and how to install the REST 2.0 API and the authentication token package.

Thanks

Which version of RT are you on? And Is RT located /opt/rt4/?

If RT is not located at /opt/rt4 you can do export RTHOME=/path/to/rt then re-run the extension install instructions.

I am on version 4.4. However, the extension install instructions didn’t work even after running that command.

Try:

export PERL5LIB=/opt/rt4/lib

in the shell before running perl Makefile.PL, replacing /opt/rt4/lib with whatever path you have to your RT library files on your installation. Your RT.pm file isn’t in a standard Perl library location for your machine so this may tell Perl how to find it.

Still no luck with that

Hmm, that’s odd. Let’s just try a little test. I wrote a quick script that just uses RT.pm, which doesn’t run from my home directory with the same error as you had. By setting PERL5LIB, it then works. Can you try the same thing, just to make sure that the path you think RT.pm is in is correct?

$ cat rttest
#!/usr/bin/perl

use strict;
use RT;

print "It works!\n";

$ ./rttest 
Can't locate RT.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./rttest line 4.
BEGIN failed--compilation aborted at ./rttest line 4.
$ export PERL5LIB=/opt/rt4/lib/
$ ./rttest 
It works!
$ 

If that works, then something in the Makefile must be messing with the library paths itself.

Sorry if I’m not understanding, i’m a bit new to RT and Ubuntu file structures. Where did you place this script?

I believe it is a standalone Perl script so you can place it wherever

Put it in your home directory for example - that’s where I had it on our RT installation.

Ended up fixing this error thanks for the help.