Menu

Connect two iTop instances

2018-09-18
2021-05-28
  • Andrés Regalado Guerrero

    Hi everyone!

    I need your help. I have two different instances of iTop, they also are hosted in different servers. The 'A' instance is the third level service desk, while the 'B' instance is the second level service desk. I manage the first one. Obviously, the function of the 'A' instance is receive all the scalated incidents from the 'B' instance. So, my question is how can I relate an incident from instance 'B' with an incident in instance 'A'?

    I have planned to add a field in the incident class, to refer to the 'B' instance incidents. But how can I indicate the relation between the incidents? Could anybody help me? Is it clear what I need?

    Greetings.

     
  • Guillaume Lajarige

    Hi Andres,

    You could create a field to refer to the remote ticket id and update it via the REST API.

    You can also contact the sales department at Combodo, they made some case exchange extensions for this kind of purpose with several customers.

    Guillaume

     
    • Andrés Regalado Guerrero

      Thanks for your reply Guillaume,

      I know how to create the field, but I still have problems with the REST API, how does it works? I've read the documentation and even have tested the jsfiddle playground and get the incident JSON, but in that point, I don't know how to use that JSON (to be honest, I'm practically a beginner in the JSON theme).

       
  • Guillaume Lajarige

    You would have to create iTop extensions for each instances, using the REST API in PHP scripts to interact whenever it is necessary.

    Are you familiar with PHP development?

     

    Last edit: Guillaume Lajarige 2018-10-01
    • Andrés Regalado Guerrero

      Yes, I'm not expert but I can work with PHP. The problem is I can create the extension in one of the instances, but I don't have access to the other.

       
      • Guillaume Lajarige

        If you don't have access to the remote instance, all you will be able to do is:
        - Create / update objects in the remote instance
        - Get objects information from the remote instance

        You could get something working, but might be kind of messy.

        Note: Obviously, you will need an account with REST profile allowed on the remote iTop.

         
        • Andrés Regalado Guerrero

          In fact, I only want to get the incident information of the remote instance. The goal is relate the incidents, like father-child incidents, to give a proper follow-up to the incidents in our Service Desk.

           
  • Andrés Regalado Guerrero

    UPDATE - I'm starting to understand and work with JSON. I already know how to get the incidents information and how to create a new incident from the 'core/create' operation. Now I'm struggling with the objects id. I mean, if I execute the 'core/get' operation, I get the JSON with the following structure:

    {
    "objects": {
    "Incident::1117": {
    "code": 0,
    "message": "",
    "class": "Incident",
    "key": "1117",
    "fields": {
    "operational_status": "ongoing",
    "ref": "IMS-001117",
    "org_id": "1",
    ...

    How can I get only the 'Incident::1117' value (and the consequent values)?

     
  • Vincent @ Combodo

    {
       "operation": "core/get",
       "class": "Incident",
       "key": 1117,
       "output_fields": "*"
    }
    
     
    • Andrés Regalado Guerrero

      Thanks vdumas, but I think I need to extract the data from the JSON in PHP. I mean, I can assign the value of a field with a line code like this:

      $iTitle = $decoded_response['objects']['Incident:1117']['fields']['title'];

       
    • Andrés Regalado Guerrero

      Thanks vdumas, but I think I wasn't clear. I need to extract the data from the JSON in PHP. I mean, I can assign the value of a field with a line code like this:

      $iTitle = $decoded_response['objects']['Incident:1117']['fields']['title'];

      And after that, I can use '$iTitle' to insert it in the 'core/create' operation. The problem here is how can I get the "['Incident::1117']" value, to perform the data extraction dinamically. If I try with "$decoded_response['objects']", I get the whole array, and I only need the 'head' or the name of the arrays (in this case, 'Incident::xxxx'). Is it clear what I need? Any idea of how solve this?

       
  • Andrés Regalado Guerrero

    Hi everyone!!

    After a few weeks working with JSON and PHP, finally I can say I solve my problem. I already can extract the incident information from a remote iTop instance and insert that information in a new incident on my own iTop instance.

    If anyone else here is interested in the solution, please tell me and I can share what I've done.

    Greetings.

     
  • Mlaura

    Mlaura - 2021-05-27

    Hi Andreas,

    could you please show how you decode/extract the JSON result? Many thanks

     
    • Jeffrey Bostoen

      Jeffrey Bostoen - 2021-05-28

      https://github.com/jbostoen/itop-jb-rest might help you if you're looking for a PHP implementation

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.