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

    Problems creating person objects

    Scheduled Pinned Locked Moved Development
    3 Posts 2 Posters 214 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.
    • B Offline
      bw
      last edited by bw

      Hello,

      I am relatively new to the I-Doit API. I have the following json request to create a new person object:

      {
          "method":  "cmdb.object.create",
          "params":  {
                         "categories":  {
                                            "C__CATG__LOGIN":  {
                                                                   "disable_login":  1,
                                                                   "username":  "logonname"
                                                               },
                                            "C__CATG__ORGANIZATION_ASSIGNMENT":  {
                                                                                     "assigned_organization":  31
                                                                                 },
                                            "C__CATG__CONTACT":  {
                                                                     "phone_company":  "+049 3641 111 111"
                                                                 },
                                            "C__CATG__PERSON":  {
                                                                    "mail_address":  "firstname.lastname@domain.com",
                                                                    "last_name":  "lastname",
                                                                    "first_name":  "firstname"
                                                                }
                                        },
                         "title":  "firstname lastname",
                         "apikey":  "apikey",
                         "type":  "C__OBJTYPE__PERSON"
                     },
          "id":  343653293,
          "jsonrpc":  "2.0"
      }
      
      

      Unfortunately I always get the following error:

      code=-32600; message=Invalid request : Provided request is not a valid json rpc.; data=

      Can someone tell me what I am doing wrong here? The header is correct, it also works for creating server objects...

      1 Reply Last reply Reply Quote 0
      • Michael HuhnM Offline
        Michael Huhn
        last edited by

        undefined @bw

        versuch es mal damit:

        {
            "method": "cmdb.object.create",
            "params": {
                "categories": {
                    "C__CATG__LOGIN": [
                        {
                            "disable_login": 1,
                            "username": "logonname"
                        }
                    ],
                    "C__CATG__ORGANIZATION_ASSIGNMENT": [
                        {
                            "assigned_organization": 31
                        }
                    ],
                    "C__CATG__CONTACT": [
                        {
                            "phone_company": "+049 3641 111 111"
                        }
                    ],
                    "C__CATG__PERSON": [
                        {
                            "mail_address": "firstname.lastname@domain.com",
                            "last_name": "lastname",
                            "first_name": "firstname"
                        }
                    ]
                },
                "title": "firstname lastname",
                "apikey": "apikey",
                "type": "C__OBJTYPE__PERSON"
            },
            "id": 343653293,
            "jsonrpc": "2.0"
        }
        1 Reply Last reply Reply Quote 0
        • Michael HuhnM Offline
          Michael Huhn
          last edited by Michael Huhn

          And here are the corrected categories 😆

          {
              "method": "cmdb.object.create",
              "params": {
                  "categories": {
                      "C__CATS__PERSON_LOGIN": [
                          {
                              "disable_login": 1,
                              "username": "logonname"
                          }
                      ],
                      "C__CATS__PERSON_MASTER": [
                          {
                              "assigned_organization": 31,
                              "phone_company": "+049 3641 111 111",
                              "mail_address": "firstname.lastname@domain.com",
                              "last_name": "lastname",
                              "first_name": "firstname"
                          }
                      ]
                  },
                  "title": "firstname lastname",
                  "apikey": "apikey",
                  "type": "C__OBJTYPE__PERSON"
              },
              "id": 343653293,
              "jsonrpc": "2.0"
          }
          

          You can find the Constants here -> https://kb.i-doit.com/en/i-doit-pro-add-ons/api/index.html#attribute-documentation

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