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