i-doit / api-client-php

Easy-to-use, but feature-rich client library for i-doit's JSON-RPC API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vielleicht ein bug

frisbee23 opened this issue · comments

hallo benjamin,
ich hab versucht einen entry fuer eine custom category anzulegen, mit folgendem syntax:

$entryID = $category->create(
$objectID,
'C__CATG__CUSTOM_FIELDS_MONITORINGCHECKS',
[
'f_text_c_1506087447500' => "textual-content",
'f_link_c_1506087469287' => "textual-content"
]
);

-> der eintrag wird nicht angelegt. und die api gibt mir folgendes zurueck:
[2017-09-26 14:42:50 0.07164900] INFO: JSON-RPC controller started for request: array ( 'version' => '2.0', 'method' => 'cmdb.category.create', 'params' => array ( 'objID' => 28, 'data' => array (
'f_text_c_1506087447500' => 'textual-content', 'f_link_c_1506087469287' => 'textual-content', ), 'catgID' => 'C__CATG__CUSTOM_FIELDS_MONITORINGCHECKS', 'apikey' => '5usn4n47e', ), 'id' => 5
,)
[2017-09-26 14:42:50 0.07166200] INFO: API-Key: 5usn4n47e
[2017-09-26 14:42:50 0.07167900] INFO: Logging in with RPC Session header (User: controller)
[2017-09-26 14:42:50 0.08476800] INFO: Logged in as controller
[2017-09-26 14:42:50 0.08773100] INFO: Method: create
[2017-09-26 14:42:50 0.11641700] INFO: Data: array (
)
[2017-09-26 14:42:50 0.11647600] INFO: Transmitting response: {"jsonrpc":"2.0","result":{"id":"1","message":"Category entry successfully created.","success":true},"id":5}
[2017-09-26 14:42:50 0.11649200] INFO: Request with id 5 transmitted.

mit dem custom-request geht es hingegen:
$result = $api->request("cmdb.category.create",
array(
"language"=> "en",
"category"=> "C__CATG__CUSTOM_FIELDS_MONITORINGCHECKS",
"objID"=> $objectID,
"data"=>array (
"f_text_c_1506087447500"=> "textual-content",
"f_link_c_1506087469287"=> "textual-content"
)
)
);//*/

2017-09-26 14:43:43 0.86415100] INFO: JSON-RPC controller started for request: array ( 'version' => '2.0', 'method' => 'cmdb.category.create', 'params' => array ( 'language' => 'en', 'category' => 'C
__CATG__CUSTOM_FIELDS_MONITORINGCHECKS', 'objID' => 28, 'data' => array ( 'f_text_c_1506087447500' => 'textual-content', 'f_link_c_1506087469287' => 'textual-content', ), 'apikey' => '5
usn4n47e', ), 'id' => 5,)
[2017-09-26 14:43:43 0.86417100] INFO: API-Key: 5usn4n47e
[2017-09-26 14:43:43 0.86419900] INFO: Logging in with RPC Session header (User: controller)
[2017-09-26 14:43:43 0.87787000] INFO: Logged in as controller
[2017-09-26 14:43:43 0.88046100] INFO: Method: create
[2017-09-26 14:43:43 0.92881000] INFO: Data: array (
)
[2017-09-26 14:43:43 0.92888800] INFO: Transmitting response: {"jsonrpc":"2.0","result":{"id":6,"message":"Category entry successfully created.","success":true},"id":5}
[2017-09-26 14:43:43 0.92890700] INFO: Request with id 5 transmitted.

der unterschied scheint einmal category und andernmal catgID im request zu sein.
ich hab auch versucht statt der 'constant' C__CATG__CUSTOM_FIELDS_MONITORINGCHECKS, wie der feld name es suggeriert die id dieser custom category anzugeben. aber ich weiss nicht ob ich da die richtige, art, in meinem fall '2' erwischt habe. hat jedenfalls auch nicht funktioniert.

ich hab kein problem weil ich das einfach mit dem custom request jetzt lassen werde. aber ich dachte ich schreib dir das, falls da ein bug is, und du zeit und lust hast, das zu perfektionieren.

commented

English explanation below.


Hi,

du bist tatsächlich auf einen Bug gestoßen. Mit dem letzten Commit sollte dieser behoben sein. Bitte probier es einmal mit deinem Code aus. Vielen Dank für den Hinweis!

Ben


User was unable to create entries for a custom category. This was a bug and got fixed.