职位API

在Zoho CRM中,管理员将职位分配给用户。职位,例如经理、销售代表、销售主管、产品经理等,表示公司中不同级别的员工。使用此API检索关于Zoho CRM中各种职位的信息。

获取职位

目的

通过API请求检索职位的数据。

请求URL

https://www.zohoapis.com.cn/crm/v2/settings/roles

请求方法

GET

范围

scope=ZohoCRM.settings.roles.{operation_type}

可能的操作类型
ALL - 完全访问职位数据
READ - 获取职位数据

示例请求


				curl "https://www.zohoapis.com.cn/crm/v2/settings/roles"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"			

示例响应


				{
    "roles": [
       {
            "display_label": "CEO",
            "name": "CEO",
            "id": "2883756000000026005",
            "reporting_to": null,
            "admin_user": true
        },
       {
            "display_label": "Manager",
            "name": "Manager",
            "id": "2883756000000026008",
            "reporting_to": {
                "name": "CEO",
                "id": "2883756000000026005"
            },
            "admin_user": false
        },
       {
            "display_label": "Supervisors",
            "name": "Supervisors",
            "id": "2883756000000243007",
            "reporting_to": {
                "name": "Manager",
                "id": "2883756000000026008"
            },
            "admin_user": false
        },
       {
            "display_label": "Sales Reps",
            "name": "Sales Reps",
            "id": "2883756000000243013",
            "reporting_to": {
                "name": "Supervisors",
                "id": "2883756000000243007"
            },
            "admin_user": false
        },
       {
            "display_label": "Product Managers",
            "name": "Product Managers",
            "id": "2883756000000243019",
            "reporting_to": {
                "name": "CEO",
                "id": "2883756000000026005"
            },
            "admin_user": false
        }
    ]
}			

示例请求


				def get_roles(self):
          try:
            resp=ZCRMOrganization.get_instance().get_all_roles()
            roles=resp.data
            print resp.status_code
            for role in roles:
              print "\n\n"
              print role.name
              print role.id
              print role.display_label
              print role.is_admin
              if role.reporting_to is not None:
                print role.reporting_to.id
                print role.reporting_to.name
          except ZCRMException as ex:
            print ex.status_code
            print ex.error_message
            print ex.error_code
            print ex.error_details
            print ex.error_content			

示例响应


				{
    "roles": [
       {
            "display_label": "CEO",
            "name": "CEO",
            "id": "2883756000000026005",
            "reporting_to": null,
            "admin_user": true
        },
       {
            "display_label": "Manager",
            "name": "Manager",
            "id": "2883756000000026008",
            "reporting_to": {
                "name": "CEO",
                "id": "2883756000000026005"
            },
            "admin_user": false
        },
       {
            "display_label": "Supervisors",
            "name": "Supervisors",
            "id": "2883756000000243007",
            "reporting_to": {
                "name": "Manager",
                "id": "2883756000000026008"
            },
            "admin_user": false
        },
       {
            "display_label": "Sales Reps",
            "name": "Sales Reps",
            "id": "2883756000000243013",
            "reporting_to": {
                "name": "Supervisors",
                "id": "2883756000000243007"
            },
            "admin_user": false
        },
       {
            "display_label": "Product Managers",
            "name": "Product Managers",
            "id": "2883756000000243019",
            "reporting_to": {
                "name": "CEO",
                "id": "2883756000000026005"
            },
            "admin_user": false
        }
    ]
}			

示例请求


				ZCRMRestClient restClient = ZCRMRestClient.GetInstance();
BulkAPIResponse<ZCRMRole> response = restClient.GetOrganizationInstance().GetAllRoles();
List<ZCRMRole> roles = response.BulkData; // roles - ZCRMRole实例的列表		

示例响应


				{
    "roles": [
       {
            "display_label": "CEO",
            "name": "CEO",
            "id": "2883756000000026005",
            "reporting_to": null,
            "admin_user": true
        },
       {
            "display_label": "Manager",
            "name": "Manager",
            "id": "2883756000000026008",
            "reporting_to": {
                "name": "CEO",
                "id": "2883756000000026005"
            },
            "admin_user": false
        },
       {
            "display_label": "Supervisors",
            "name": "Supervisors",
            "id": "2883756000000243007",
            "reporting_to": {
                "name": "Manager",
                "id": "2883756000000026008"
            },
            "admin_user": false
        },
       {
            "display_label": "Sales Reps",
            "name": "Sales Reps",
            "id": "2883756000000243013",
            "reporting_to": {
                "name": "Supervisors",
                "id": "2883756000000243007"
            },
            "admin_user": false
        },
       {
            "display_label": "Product Managers",
            "name": "Product Managers",
            "id": "2883756000000243019",
            "reporting_to": {
                "name": "CEO",
                "id": "2883756000000026005"
            },
            "admin_user": false
        }
    ]
}