API für i-doit
-
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
-
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.
-
Kann jemand mir einen ganz simpleren json request vorstellen so dass ich mit JSON-RPC Schnittstelle testen kann mit cURL.
-
Ich habe es dann doch selbst hingekriegt mit cURL, also folgendes zum testen i-doit JSON-RPC API mit cURL:
- Aktivierung von JSON-RPC Schnittstelle bei generieren von API-Key: Administration > Interfaces > JSON-RPC API
- 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 }- 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- 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"}- 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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login