You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2014-05-06 10:17:02

jroza
Member
Registered: 2014-04-29
Posts: 8

Import Tickets from a different system to GLPI

Hi, I'm trying to import tickets from another system (JIRA) to GLPI. I've read a tutorial in the forum (http://www.glpi-project.org/wiki/doku.p … tsintoglpi) but it seems very complicated and it uses an old version of GLPI ( 0.80.2 version of GLPI and I have the 0.84.5) so I don't even know if it would help in the new version. Could anyone help me, please?
Thank in advance.

Offline

#2 2014-05-08 05:51:32

chris.anderson3
Member
Registered: 2013-11-06
Posts: 36

Re: Import Tickets from a different system to GLPI

Hello,

I have done this... and there is no easy way to do it.  The 'Injection' plugin does not allow you to enter tickets. 

For automation, I ended up performing a 'dummy' insert to get a sample 'INSERT'.  Then I exported that code into a .CSV file and copied and pasted records into the column from my other 'database' into the appropriate fields.  Once populated, I opened the .CSV file in notepad ++ to build the SQL INSERT query and manually injected it through PHPMYAdmin directly into the database.

The horrid part in doing it this way is that you spend LOTS of time chasing down apostrphes during the SQL troubleshooting stage.  But then you get to copy and paste your Ticket data from the JIRA export into Excel.  However - Tickets have several other tables associated with them - so you have to reverse engineer the GLPI database schema (not hard.. but takes a while). 

Alternatively, you can download the WebServices plugin and write a loop function in PHP to perform the ticket creations by parsing your existing datafile. If I were a smart man, I'd have done it this way...

However, I spent a day trying to figure out the WebServices Plugin.  Here's the example code that I got to work.  The documentation is abysmal... once I get better at it, I'll write up a good tutorial...

<?php
/*
 * @version $Id: examplexmlrpc.php 306 2011-11-08 12:36:05Z remi $
 -------------------------------------------------------------------------
 webservices - WebServices plugin for GLPI
 Copyright (C) 2003-2011 by the webservices Development Team.
*/
//This is the magic xmlrpc code that makes the plugin work.  
if (!extension_loaded("xmlrpc")) {
   die("Extension xmlrpc not loaded\n");
}

/*
* SETTINGS
*/
chdir(dirname($_SERVER["SCRIPT_FILENAME"]));
//chdir("../../..");
$url = "glpi/plugins/webservices/xmlrpc.php";
// this URL depends on where you place your script to run... try out some basic stuff to ensure that this path is correct...


/*
* ACTIONS
*/

//HEY - THIS IS THE CODE THAT IS ACTUALLY DOING SOMETHING
//-----------------------------------------------------

// Init sessions
$host = localhost;
$glpi_user = "glpi";
$glpi_pass = "whatever_your_admin_password_is";
$session = login();

//Do some data massaging here for your original data. 
//Then start your loop...
/*
* Update Ticket with Solution
*/
$args['session'] = $session;
$args['method']  = 'glpi.updateObjects';
$args['fields']  = array('Ticket' => array(array('id'               => '186',
                                                  'solutiontypes_id'            => '3',
                                                  'solution'        => 'Some Solution information!2')));
//You'll probably want to add more to the array, for each of the items you want to change.  

//THis actually implements the command
print_r(call_glpi($args));  
//You'll want to complete your loop here
logout();

// the rest of the code below this is a direct copy out of the WebServices Example that is provided with the plugin.    


The difference for you will be to use the 'glpi.createTicket' method instead of the 'glpi.updateObjects' method that I have noted above.

Here is the documentation for the plugin:
https://forge.indepnet.net/projects/web … n_devguide

From there, you should be able to echo out any 'success' as a result.  By the way - you'll need to look at the backend names of the column fields to set each one. 

The only difference between the webservices plugin and raw SQL injection is that WebServices fire's the Notifications and you don't have to write the SQL code.  Whichever way is less painful for you will be the way to go.

Have fun (or at least as much as is possible).  Jira is awesome.. .why would you ever leave?

-Chris

Last edited by chris.anderson3 (2014-05-08 05:55:09)


GLPI 90.5     XAMPP- 1.8.2  Apache/2.4.10 (Win32) OpenSSL/1.0.1h PHP/5.4.31

Offline

#3 2019-07-17 09:08:36

prakashc
Member
Registered: 2019-05-27
Posts: 3

Re: Import Tickets from a different system to GLPI

i was trying to import tickets from OTRS 3.1 to glpi GLPI 9.4.2

i have tried this but its to complicate  https://wiki.glpi-project.org/doku.php? … tsintoglpi


can any one help me on this

Offline

#4 2020-03-04 18:19:12

Cosmin
Member
Registered: 2020-02-28
Posts: 3

Re: Import Tickets from a different system to GLPI

Seguo

Offline

#5 2022-06-24 16:03:49

JoaoSintra
Member
Registered: 2022-06-17
Posts: 5

Re: Import Tickets from a different system to GLPI

I've made a php script to insert directly inside GLPI database with a tickets export from spiceworks

github.com/joaosintra14/ImportTicketsFromSpiceworksToGLPI

I hope this can help smile

Offline

Board footer

Powered by FluxBB