Add User CI

V3 API (After 11000 onwards)

V1 API (Prior to 11000)

 

V3 API (After 11000 onwards)

To add a user CI use the following URL format:

URL

<protocol>://<hostname>:<port number>/api/v3/users

Sample Input

 

{
  "user": {
    "first_name": "Peter",
    "middle_name": "Rabbit",
    "last_name": "Atom",
    "name": "Peter Rabbit Atom",
    "is_vipuser": "false",
    "employee_id": "4229",
    "department": {
      "id": "5"
    },
    "mobile": "02892902",
    "description": "Help Desk manager",
    "sms_mail_id": "atom@sms.com",
    "jobtitle": "Java developer",
    "phone": "929992",
    "email_id": "peter@zoho.com",
    "secondary_emailids": [
      "peter@zohocorp.com",
      "rabbit@zohocorp.com",
      "atom@zoho.com"
    ],
    "cost_per_hour": "929",
    "service_request_approver": "true",
    "purchase_approver": "true",
    "purchase_approval_limit": "-1",
    "project_roles": {
      "id": "3"
    },
    "reporting_to": {
      "id": "4"
    },
    "requester_allowed_to_view": "0",
    "login_name": "peter",
    "password": "peter",
    "domain": {
      "id": "2"
    },
    "user_udf_fields": {
      "udf_long_3": "982999292",
      "udf_date_4": {
        "value": "1569519360000"
      },
      "udf_pick_2": "Market gaps",
      "udf_sline_1": "Manager"
    },
    "ci_default_fields": {
      "udf_pick_165": "Team member",
      "udf_pickref_1": {
        "id": 2
      },
      "udf_sline_164": "Testing line"
    },
    "ci_user_fields": {
      "udf_pickref_160": null,
      "udf_sline_158": "929",
      "udf_pick_163": "7 th floor",
      "udf_pickref_161": {
        "id": "6"
      },
      "udf_pickref_159": {
        "id": "2"
      },
      "udf_sline_162": "928KSi82"
    }
  }
}

Sample Output

 

{
  "user": {
    "first_name": "Peter",
    "middle_name": "Rabbit",
    "last_name": "Atom",
    "name": "Peter Rabbit Atom",
    "is_vipuser": false,
    "employee_id": "4229",
    "department": {
      "id": "5",
      "site": null,
      "name": "IT Services"
    },
    "mobile": "02892902",
    "description": "Help Desk manager",
    "sms_mail_id": "atom@sms.com",
    "jobtitle": "Java developer",
    "phone": "929992",
    "email_id": "peter@zoho.com",
    "secondary_emailids": [
      "atom@zoho.com",
      "rabbit@zohocorp.com",
      "peter@zohocorp.com"
    ],
    "cost_per_hour": "929.00",
    "service_request_approver": true,
    "purchase_approver": true,
    "purchase_approval_limit": "-1.00",
    "project_roles": {
      "id": "3",
      "name": "Project Manager"
    },
    "reporting_to": {
      "id": "4",
      "email_id": null,
      "name": "administrator",
      "is_vipuser": false,
      "department": null
    },
    "requester_allowed_to_view": null,
    "login_name": "peter",
    "domain": {
      "id": "2",
      "name": "ZOHOCORP"
    },
    "user_udf_fields": {
      "udf_long_3": "982999292",
      "udf_date_4": {
        "value": "1569519360000",
        "display_value": "Sep 26, 2019 11:06 PM"
      },
      "udf_pick_2": "Market gaps",
      "udf_sline_1": "Manager"
    },
    "ci_default_fields": {
      "udf_pick_165": "Team member",
      "udf_pickref_1": {
        "id": 2,
        "name": "Medium"
      },
      "udf_sline_164": "Testing line"
    },
    "ci_user_fields": {
      "udf_pickref_160": null,
      "udf_sline_158": "929",
      "udf_pick_163": "7 th floor",
      "udf_pickref_161": {
        "id": 6,
        "name": "Heather Graham"
      },
      "udf_pickref_159": {
        "id": 2,
        "site": null,
        "name": "Engineering"
      },
      "udf_sline_162": "928KSi82"
    },
    "attachments": [],
    "ci_people_fields": {},
    "org_roles": [],
    "type": "User",
    "org_user_status": "ACTIVE",
    "id": "10",
    "profile_pic_url": null,
    "created_time": {
      "display_value": "Sep 6, 2019 06:58 AM",
      "value": "1567733299627"
    },
    "is_technician": false,
    "ciid": "25",
    "associated_roles": [
      {
        "name": "SDGuest",
        "id": "29"
      }
    ],
    "status": "ACTIVE"
  },
  "response_status": {
    "status_code": 2000,
    "status": "success"
  }
}


V1 API (Builds prior to 11000)

To add requester CI use the following URL format:

 

http://<servername>:<portnumber>/api/cmdb/ci/

Assuming you are adding a requester CI in the local server with port number 8080, the URL should be given as::

http://localhost:8080/api/cmdb/ci

 

 

Keypoints:

 

 

  1. Input is an XML string sent as "POST attribute" with key "INPUT_DATA".

  2. The operation name "add"  should be sent as a "POST attribute" with key "OPERATION_NAME".

  3. The technician key should be sent as a "POST attribute" with key "TECHNICIAN_KEY".

 

 

Note:  

If no result format specified then API will return output in JSON format.

  • Technician with rights to adding assets (asset addition role) can perform add operations on assets CIs like workstaions,printers etc.

  • Technician having SDAdmin role can perform add operations on admin CIs like Business Service, Department etc.

  • CI-ID of the newly added entry is returned along with the CI Name in the response.

  • Technicians can add more than one C(s) using the <record> </record> tags.

  • CI Attributes, Global Attributes and custom CI Attributes for the corresponding CI Type can be added.

  • All asset additional attributes can be added

  • Parameter Result Format - Optional. specifies the return format ( XML or JSON )

 

 

 

 

 

 

Sample Input for adding Requester:

 

 

 

 

 

<?xml version="1.0" encoding="UTF-8"?>

<API version="1.0" locale="en">

    <records>

    <record>

        <parameter><name>Name</name><value>Prakash</value></parameter>

        <parameter><name>CI Type</name><value>Requester</value></parameter>

        <parameter><name>Site</name><value>Japan</value></parameter>

        <parameter><name>Business Impact</name><value>Medium</value></parameter>        

        <parameter><name>Description</name><value>New user joined to ZOHO</value></parameter>

        <parameter><name>Employee ID</name><value>0658</value></parameter>

        <parameter><name>E-mail</name><value>prakash_jp_4323@zoho.com</value></parameter>

        <parameter><name>Phone</name><value>9159840336</value></parameter>

        <parameter><name>Mobile</name><value>9159840336</value></parameter>

        <parameter><name>Department Name</name><value>Finance</value></parameter>

        <parameter><name>Department's site</name><value>Pleasanton,CA</value></parameter>

        <parameter><name>Job title</name><value>MTS</value></parameter>        

    </record>

    </records>

</API>