• Is there an example somewhere to return all of the data from an object? I see the CLI and PHP API wrappers have a "load" method that does this, but it would be nice to have an example of how?

    Alternatively how do I request just the data for one or two specific categories attached to an object (Contact info, or custom attributes for example).

    Also, is there an English version of this document please:
    https://kb.i-doit.com/download/attachments/37355644/i-doit JSON-RPC 1.8.3.pdf?version=1&modificationDate=1489677685764&api=v2

  • i-doIT Team


    Sorry for the late answer.

    To "load" everything about an object:

    1. Fetch common information about an object by cmdb.object.read or cmdb.objects.read. Now you know its object type.
    2. Fetch all relevant categories for this object by cmdb.object_type_categories.read. Now you know all category constants.
    3. Read all attributes from every category with a batch request. For every category use cmdb.category.read.

    Within 3 API requests you know has every detail about an object.

    In a future release we will enhance the API so only 1 request is needed.

    At the moment, we are migrating the out-dated PDF documentation to this KB article. I hope it helps.


  • I already figured out step one and two. But I stumble upon the third one.

    Is there a way to receive all category related data for an object in one API request? Currently I need to do ~30 requests per object (because there are that many categories attached to it) which performs quite poor when fetching 400 records.

    12000 HTTP requests for reading the data related to 400 objects is a lot IMO. Is there something I am missing or is this currently not supported? (i-doit 1.11)

  • i-doIT Team


    you definitely should use batch requests to reduce API requests significantly. Put the 30 cmdb.category.read requests for an object into one batch request. That means for 400 objects you only need 400 batch requests instead of 12.000.

    In most cases you can combine the 30 cmdb.category.read requests for more than one object into only one batch request. On a fast¹ i-doit host you may put up to ~ 600 requests into one batch request – maybe even more:

    400 objects x 30 categories / 600 requests per batch request = 20 batch requests

    Happy coding
    — Benjamin

    ¹ for example, fast DB with a lot of i/o (flash memory or everything loaded into ram), 1-2 gigs of RAM for each PHP process

  • Thank you for the reply! This sounds much better 🙂

    While I wanted to ask again about this batch requests, I did some additionaly research...

    The only mentioning of batch request that I found in the i-doit documentation is in the "Tips and Tricks" section - the API documentation (1, 2, 3, 4) does not contain a single word.

    There is the JSON RPC 2.0 documentation, which specifies it - but the outdated PDF documentation tells me that batch is not supported.

    EDIT: ok, outdated docs tell that batch requests are supported since 1.4...

    Would be cool to get more information on that topic directly in the docs - because if you really want to do something useful with your API IMO this information is absolutely required. Otherwise you'll waste a lot of time with HTTP requests. And JSON RPC 2.0 is not that well known, that you can assume everybody knows that before. It is neither SOAP nor REST 😉

    Nevertheless - thanks for pointing me in the proper direction! I'll try this now.