Community
    • Categories
    • Recent
    • Popular
    • Users
    • Search
    • Register
    • Login

    API für i-doit

    Scheduled Pinned Locked Moved Allgemein
    4 Posts 2 Posters 4.1k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • _Chekov__ Offline
      _Chekov_
      last edited by

      Hallo zusammen,

      gibt es eigentlich API für das i-doit System, oder ist so was in der Art geplant?
      Wenn da eine API schon existiert, gibt es dafür Dokumentation?

      Viele Grüße,

      Chekov

      Chekov is using i-doit v1.6.4 PRO in production & i-doit v1.7 PRO in test

      1 Reply Last reply Reply Quote 0
      • A Offline
        alex123
        last edited by

        Eine API gibt es! Man kann über die JSON-RPC Schnittstelle auf die CMDB zugreifen, also lesen, schreiben, löschen und anlegen.
        Auf der i-doit Akademie Webseite gibt es ein Handbuch zum Download: http://akademie.i-doit.com/

        Ich habe speziell für Java eine Klasse entwickelt, die den Zugriff auf die i-doit CMDB über die JSON-RPC Schnittstelle vereinfacht. Schreib mich an, wenn Interesse besteht.

        1 Reply Last reply Reply Quote 0
        • _Chekov__ Offline
          _Chekov_
          last edited by

          Kann jemand mir einen ganz simpleren json request vorstellen so dass ich mit JSON-RPC Schnittstelle testen kann mit cURL.

          Chekov is using i-doit v1.6.4 PRO in production & i-doit v1.7 PRO in test

          1 Reply Last reply Reply Quote 0
          • _Chekov__ Offline
            _Chekov_
            last edited by

            Ich habe es dann doch selbst hingekriegt mit cURL, also folgendes zum testen i-doit JSON-RPC API mit cURL:

            1. Aktivierung von JSON-RPC Schnittstelle bei generieren von API-Key: Administration > Interfaces > JSON-RPC API
            2. Bau deine JSON-Request und speichere die folgenden Zeilen auf eine Datei ein, z.B.: request.json
            
            {
            	"version": "2.0",
            	"method": "cmdb.category",
            	"params": { 
            		"apikey": "api-key-here",
            		"objID": 20421,
            		"catgID": 4
            	},
            	"id": 1
            }
            
            
            1. Durchführe deine JSON-Request mit cURL:
            
            curl -v -H "Content-Type: application/json" -X POST --data "@request.json" http://your-idoit-URL/src/jsonrpc.php
            
            
            1. Mit richtigen JSON-Request kommt irgend was wie folgendes zurück (raw, ohne formatierung):
            
            {"result":[{"id":"1881","objID":"20421","title":"Intel(R) Core(TM) i7-3630QM CPU @ 2.40GHz","manufacturer":{"id":"2","title":"Intel","const":null,"title_lang":"Intel"},"type":{"id":"11","title":"Core I7","const":null,"title_lang":"Core I7"},"frequency":{"title":2.4},"frequency_unit":{"id":"3","title":"GHz","const":"C__FREQUENCY_UNIT__GHZ","title_lang":"GHz"},"cores":"8","description":""}],"id":1,"jsonrpc":"2.0"}
            
            
            1. Obere JSON-Response nochmal (mit formatierung für bessere lesbarkeit):
            
            {
            	"result": 
            	[
            		{
            		"id": "1881",
            		"objID": "20421",
            		"title": "Intel(R) Core(TM) i7-3630QM CPU @ 2.40GHz", 
            		"manufacturer": 
            			{
            			"id": "2",
            			"title": "Intel", 
            			"const": null,
            			"title_lang": "Intel"
            			},
            		"type":
            			{
            			"id": "11",
            			"title": "Core I7",
            			"const": null,
            			"title_lang": "Core I7"
            			},
            		"frequency":
            			{
            			"title": 2.4
            			},
            		"frequency_unit":
            			{
            			"id": "3",
            			"title": "GHz",
            			"const": "C__FREQUENCY_UNIT__GHZ",
            			"title_lang": "GHz"
            			},
            		"cores": "8",
            		"description": ""
            		}
            	],
            	"id": 1,
            	"jsonrpc": "2.0"
            }
            
            

            Also ich habe oben einem Request durchgeführt was fragte die CPU-Details von meinem Laptop aus i-doit.

            Cheers,

            Chekov

            Chekov is using i-doit v1.6.4 PRO in production & i-doit v1.7 PRO in test

            1 Reply Last reply Reply Quote 0
            • First post
              Last post