Request Tracker -
-
Im' trying to integrate RT 4.4.0 with i-doit 1.83
I'm using RT-Extension-ReferenceIDoitObjects-1.00
I can create a ticket from within i-doit and it does link to RT okay, however the "referenced i-doit objects" section of RT remains empty.
I do see the i-doit objects and i-doit tenant custom fields get updated.
I can also add an i-doit object ID to i-doit objects list and it does reflect this within i-doit immediately.
I cannot figure out how/why I cannot see the i-doit object browser with a list of objects - like it does in the CPAN screenshots.Am I missing something obvious here?
thanks
Richard
-
Hi Richard,
Welcome to the i-doit forums!
We found an issue with an out-dated version of jQuery which is shipped with RT 4.4.x. I've described a workaround in the extension's README.md: https://github.com/bheisig/rt-extension-referenceidoitobjects#issue-in-rt-44x Please let me know if it works for you.
Greetings,
Benjamin -
thanks Benjamin.
that got things closer.
I now get an error in the 'Referenced i-doit objects' ticket summary area as:
"Error while loading pre-selecting objects"
and in the 'Referenced i-doit objects' modify area as:
"Error while loading object types"I created a brand new object in i-doit incase my previous 'import' has issues and created the ticket okay from i-doit -> RT as expected. the i-doit fields updated as expected:
i-doit objects: 1283
i-doit tenant: 1I checked the apikey was okay using:
curl –data '{"jsonrpc":"2.0","method":"idoit.version","params":{"apikey":"<redacted>"} }' --header "Content-Type: application/json" http://<redacted>/i-doit/src/jsonrpc.phpand I get an answer okay:
{"jsonrpc":"2.0","result":{"login":{"userid":"22","name":"Api System","mail":"","username":"systemapi","mandator":"<redacted>","language":"en"},"version":"1.8.3","step":"","type":"OPEN"},"id":null}my RT_idoit_config file is:
Set($RestrictReferrer, 0); # avoids possible CSR attacks
Set(@Plugins,qw(RT::Extension::ReferenceIDoitObjects));
Set($IDoitURL, 'http://<redacted>/i-doit');
Set($IDoitAPI, $IDoitURL . '?api=jsonrpc');
Set(%IDoitTenantKeys, (
1 => '<redacted>'
));Set($IDoitDefaultTenant, 1);
Set($IDoitDefaultView, 'objects'); # 'objects', 'workplaces', 'devices', or 'item'
Set($IDoitInstalledSoftware, 'objects'); # 'objects', or 'relations'
Set($IDoitShowCustomFields, 1); # 1 ('yes') or 0 ('no')
not sure what I am missing or I have configured incorrectly.
I noticed the /src/ in the curl tests so tried it again using?api=jsonrpc and it still work okay:
curl --data '{"jsonrpc":"2.0","method":"idoit.version","params":{"apikey":"<redacted>"} }' --header "Content-Type: application/json" http://<redacted>/i-doit/?api=jsonrpc
{"jsonrpc":"2.0","result":{"login":{"userid":"22","name":"Api System","mail":"","username":"systemapi","mandator":"<redacted>","language":"en"},"version":"1.8.3","step":"","type":"OPEN"},"id":null}many thanks for the help so far
Richard</redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted>
-
Hi Richard,
Do you have dedicated domains/IPs for both i-doit and RT? For example, http://mycmdb.local/i-doit/ and http://myservicedesk.local/rt/. If the answer is yes you'll have to use the API proxy script shipped with the Extension. The "problem" here is a security feature in your browser called Same Origin Policy. Here is a howto: https://github.com/bheisig/rt-extension-referenceidoitobjects#idoitapi
Greetings,
Benjamin -
hi Benjamin
RT and i-doit are both running on the same server under the same URL.
(I did have them on separate systems but this is a test installation so I collapsed onto a single server to remove any security features while I evaluated!)
are there any jsonrpc commandlets that I can run to verify that the RT plugin is making the correct call?thanks
Richard
-
Hi Richard,
There are two ways to find out: First, you can enable the setting to log every API call. This can be done in i-doit's Web GUI under Administration > System settings > Logging > Api > Yes. Logs are located under log/ in your i-doit installation. Look for files that has "api" in their names.
Second, you can see inside your browser what is going on. Open the dev tools (key F12). There should be somethind like "console". Everytime you re-load the "Create new ticket" page there should be at least one API request from your browser to i-doit.
Little background: It's not RT which sends requests to i-doit. It's your browser which handles the communication between them. RT only knows about the object IDs and the tenant ID stored in the two custom fields.
Greetings,
Benjamin -
hi benjamin
I've looked at the log files and the api is being redirected from a POST -> GET by apache for some reason (I have no redirect in place as far as i know)
the console log shows an initial POST that gets a 301 redirect to GET (last two lines on the web server log)
very confused why this is happening, but I now have something to go on.
I ran a curl commandline which gets processed as a POST quite happily!
curl –data '{"jsonrpc":"2.0","method":"idoit.version","params":{"apikey":"<redacted>"} }' --header "Content-Type: application/json" http://<redacted>/i-doit/?api=jsonrpc
output:
{"jsonrpc":"2.0","result":{"login":{"userid":"22","name":"Api System","mail":"","username":"systemapi","mandator":"<redacted>","language":"en"},"version":"1.8.3","step":"","type":"OPEN"},"id":null}weblog:
<redacted ip="">- - [05/Apr/2017:18:46:00 +0100] "POST /i-doit/?api=jsonrpc HTTP/1.1" 200 192 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2"–
--- API log --->
i-doit 1.8.3 OPEN
host URL <redacted># log for "api"
started at 2017-04-05T19:38:54+02:00
written to "/var/www/html/i-doit/log/api_2017-04-05_19_38_54.log"
[2017-04-05 19:38:54 0.73788400] ERROR: This is not a JSON-RPC. The content-type should be application/json, request method should be "post" and the http body should be a valid json-rpc 2.0 package.
[2017-04-05 19:38:54 0.73793300] INFO: SERVER: array (
'HTTP_ACCEPT' => 'application/json, text/javascript, /; q=0.01',
'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest',
'HTTP_REFERER' => 'http://<redacted>/Ticket/Create.html?Queue=1',
'HTTP_ACCEPT_LANGUAGE' => 'en-GB,en;q=0.5',
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393',
'HTTP_HOST' => '<redacted>',
'HTTP_CONNECTION' => 'Keep-Alive',
'HTTP_COOKIE' => 'ga=GA1.3.2040217694.1457960180; RT_SID<redacted>.443=98fbb15673405e32a354012dc9262271; RT_SID_<redacted>.80=5e5b38d75b79b8948a6cd9dcaf75e278; PHPSESSID=0aae7200134b744eb7157dae37f47410',
'PATH' => '/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin',
'SERVER_SIGNATURE' => '<address>Apache/2.2.15 (CentOS) Server at <redacted>Port 80</redacted></address>
',
'SERVER_SOFTWARE' => 'Apache/2.2.15 (CentOS)',
'SERVER_NAME' => '<redacted>',
'SERVER_ADDR' => '<redacted ip="">',
'SERVER_PORT' => '80',
'REMOTE_ADDR' => '<redacted ip="">',
'DOCUMENT_ROOT' => '/var/www/html',
'SERVER_ADMIN' => 'r.ruddock@qub.ac.uk',
'SCRIPT_FILENAME' => '/var/www/html/i-doit/index.php',
'REMOTE_PORT' => '9826',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'REQUEST_METHOD' => 'GET',
'QUERY_STRING' => 'api=jsonrpc',
'REQUEST_URI' => '/i-doit/?api=jsonrpc',
'SCRIPT_NAME' => '/i-doit/index.php',
'PHP_SELF' => '/i-doit/index.php',
'REQUEST_TIME_FLOAT' => 1491413934.675,
'REQUEST_TIME' => 1491413934,
)
[2017-04-05 19:38:54 0.73794600] INFO: Transmitting response: {"jsonrpc":"2.0","error":{"code":-32600,"message":"Invalid request","data":{"error":"This is not a JSON-RPC. The content-type should be application/json, request method should be "post" and the http body should be a valid json-rpc 2.0 package."}},"id":0}
[2017-04-05 19:38:54 0.73795400] INFO: Batch-Request transmitted.–- web log -->
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "GET /NoAuth/Helpers/CustomLogo/1a23ce73b6081be99cecbb6fe8da2194 HTTP/1.1" 200 14641 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "GET /static/images/ui-anim_basic_16x16.gif HTTP/1.1" 200 1553 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "GET /static/css/images/shadow.png HTTP/1.1" 200 1698 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "GET /static/images/i-doit.png HTTP/1.1" 200 10677 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "GET /static/css/images/arrows-grey.png HTTP/1.1" 200 256 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "GET /static/css/images/background-gradient.png HTTP/1.1" 200 394 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "GET /static/images/css/rollup-arrow.gif HTTP/1.1" 200 97 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "GET /NoAuth/js/jquery.dataTables.min.js HTTP/1.1" 200 77499 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "GET /NoAuth/js/chosen.jquery.min.js HTTP/1.1" 200 26966 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "GET /NoAuth/js/referenceidoitobjects.js HTTP/1.1" 200 41349 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "POST /i-doit?api=jsonrpc HTTP/1.1" 301 343 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"
<redacted ip="">- - [05/Apr/2017:18:38:54 +0100] "GET /i-doit/?api=jsonrpc HTTP/1.1" 200 257 "http://<redacted>/Ticket/Create.html?Queue=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"–- debugger output --->
Name Protocol Method Result Content type Received Time Initiator
http://<redacted>/i-doit?api=jsonrpc HTTP POST 301 text/html 343 B 10.57 ms XMLHttpRequest
http://<redacted>/i-doit/?api=jsonrpc HTTP GET 200 application/json 257 B 166.84 ms XMLHttpRequestany ideas as I am stumped at the moment? I will investigate the rewrite at my end toi see if anything 'funny' is happening.
thanks
Richard</redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted></redacted>
-
Hi Richard,
A Redirect of POST requests sounds very unusal… Can you please post your Apache configuration including the vhost settings for your i-doit installation? Thanks.
Greetings,
Benjamin