How to find the department id, siteid which can be used while adding users via API

How to find the department id, siteid which can be used while adding users via API

Query to find the deptid:

* In order to add a user under the correct department/site, the departmentid is required. The department id can be found using the below query. 

* In the application UI, go to Reports - > New query report, and execute the below query. This will show the site details and the department id. 

Select distinct adef.org_name "Account Name", asite.siteid, pdep.deptid, pdep.ciid, ddef.deptname from accountdefinition adef LEFT JOIN portalaccounts pac ON adef.org_id=pac.accountid left join 
accountci ac  on pac.ciid=ac.ciid left join accountsitemapping asite on adef.org_id=asite.accountid left join departmentdefinition ddef on asite.siteid=ddef.siteid  left join portaldepartments pdep on ddef.deptid=pdep.deptid

where adef.org_name like '%AccountName%' and ddef.deptname like '%DepartmentName%';


- > In the above filter, you shall mention the Account name and department name if you would want to know the departmentid for a specific department under which the user ought to be added. 


Adding user via API:

Now, that the department id is known, the user shall be added via API under the given department. 

Sample API Json Input:

{
    "user": {
        "first_name": "Abdullah",
        "last_name": "M",
        "name": "Abdullah M",
        "is_vipuser": "false",
        "department": {
            "id": "1"
        },
        "mobile": "02892902",
        "description": "Help Desk manager",
        "sms_mail_id": "abdullah@zoho.com",
        "jobtitle": "Java developer",
        "phone": "929992",
        "email_id": "abdullah@zoho.com",
        "secondary_emailids": [
            "Ab@zohocorp.com",
            "Ab2@zohocorp.com",
            "Ab3@zoho.com"
        ]
        }
    }



                  New to ADManager Plus?

                    New to ADSelfService Plus?

                      • Related Articles

                      • 10.5 API - How APIs can be used in the version 10.5 and above ?

                        Introduction: REST API acts as a bridge between ServiceDesk Plus MSP and other applications. The communication of information happens via HTTP Request. The REST API authenticates users using Technician Key, thus eliminating the need for the users to ...
                      • Online API documentation

                        Dear Users You can refer to the latest API document from our online demo page available here. (Login as administrator to view the same) Once login -> Goto Admin -> API -. Documentation to refer the same. or once login done -> click the below link to ...
                      • Query to find users under blocked state

                        select * from sduser sd left join CI ci on sd.ciid=ci.ciid left join AaaUserContactInfo auc on sd.userid=auc.user_id left join AaaContactInfo aci on auc.contactinfo_id=aci.contactinfo_id where sd.status='blocked'
                      • Add Attachment via API for Request Notifications.

                        Please refer to the below steps on how to add the attachments for Notifications via API. 1. Please go to API - Add Attachment to Notification API and add the request ID and the attachment. Screenshot for reference: 2. Then, you would need to find the ...
                      • Request Merge API using Postman.

                        Currently, the Merge API is not included in our documentation. However, I have tested the following API in Postman, and it is working fine on our end. API used: /api/v3/requests/<request_id>/merge_requests {"merge_requests":[{"id":"1"},{"id":"2"}]} ...