Python SDK Samples - Organization Operations

Users
Get User Details

# Get single user
# ---------------
def get_user(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_user(33721640000)# user id
        print(resp.status_code)
        if resp.status_code != 200:
            return
        users = [resp.data]
        for user in users:
            print(user.id)
            print(user.name)
            print(user.signature)
            print(user.country)
            crm_role = user.role
            if crm_role is not None:
                print(crm_role.name)
                print(crm_role.id)
            customize_info = user.customize_info
            if customize_info is not None:
                print(customize_info.notes_desc)
                print(customize_info.is_to_show_right_panel)
                print(customize_info.is_bc_view)
                print(customize_info.is_to_show_home)
                print(customize_info.is_to_show_detail_view)
                print(customize_info.unpin_recent_item)
            print(user.city)
            print(user.name_format)
            print(user.language)
            print(user.locale)
            print(user.is_personal_account)
            print(user.default_tab_group)
            print(user.street)
            print(user.alias)
            user_theme = user.theme
            if user_theme is not None:
                print(user_theme.normal_tab_font_color)
                print(user_theme.normal_tab_background)
                print(user_theme.selected_tab_font_color)
                print(user_theme.selected_tab_background)
            print(user.state)
            print(user.country_locale)
            print(user.fax)
            print(user.first_name)
            print(user.email)
            print(user.zip)
            print(user.decimal_separator)
            print(user.website)
            print(user.time_format)
            crm_profile = user.profile
            if crm_profile is not None:
                print(crm_profile.id)
                print(crm_profile.name)
            print(user.mobile)
            print(user.last_name)
            print(user.time_zone)
            print(user.zuid)
            print(user.is_confirm)
            print(user.full_name)
            print(user.phone)
            print(user.dob)
            print(user.date_format)
            print(user.status)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Get All Users

# Get all users
# -------------
def get_all_users(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_all_users()
        print(resp.status_code)
        users = resp.data
        for user in users:
            print("\n\n")
            print(user.id)
            print(user.name)
            print(user.signature)
            print(user.country)
            crm_role = user.role
            if crm_role is not None:
                print(crm_role.name)
                print(crm_role.id)
            customize_info = user.customize_info
            if customize_info is not None:
                print(customize_info.notes_desc)
                print(customize_info.is_to_show_right_panel)
                print(customize_info.is_bc_view)
                print(customize_info.is_to_show_home)
                print(customize_info.is_to_show_detail_view)
                print(customize_info.unpin_recent_item)
            print(user.city)
            print(user.name_format)
            print(user.language)
            print(user.locale)
            print(user.is_personal_account)
            print(user.default_tab_group)
            print(user.street)
            print(user.alias)
            user_theme = user.theme
            if user_theme is not None:
                print(user_theme.normal_tab_font_color)
                print(user_theme.normal_tab_background)
                print(user_theme.selected_tab_font_color)
                print(user_theme.selected_tab_background)
            print(user.state)
            print(user.country_locale)
            print(user.fax)
            print(user.first_name)
            print(user.email)
            print(user.zip)
            print(user.decimal_separator)
            print(user.website)
            print(user.time_format)
            crm_profile = user.profile
            if crm_profile is not None:
                print(crm_profile.id)
                print(crm_profile.name)
            print(user.mobile)
            print(user.last_name)
            print(user.time_zone)
            print(user.zuid)
            print(user.is_confirm)
            print(user.full_name)
            print(user.phone)
            print(user.dob)
            print(user.date_format)
            print(user.status)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Get All Active Users

# Get all active users
# --------------------
def get_all_active_users(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_all_active_users()
        print(resp.status_code)
        users = resp.data
        for user in users:
            print("\n\n")
            print(user.id)
            print(user.name)
            print(user.signature)
            print(user.country)
            crm_role = user.role
            if crm_role is not None:
                print(crm_role.name)
                print(crm_role.id)
            customize_info = user.customize_info
            if customize_info is not None:
                print(customize_info.notes_desc)
                print(customize_info.is_to_show_right_panel)
                print(customize_info.is_bc_view)
                print(customize_info.is_to_show_home)
                print(customize_info.is_to_show_detail_view)
                print(customize_info.unpin_recent_item)
            print(user.city)
            print(user.name_format)
            print(user.language)
            print(user.locale)
            print(user.is_personal_account)
            print(user.default_tab_group)
            print(user.street)
            print(user.alias)
            user_theme = user.theme
            if user_theme is not None:
                print(user_theme.normal_tab_font_color)
                print(user_theme.normal_tab_background)
                print(user_theme.selected_tab_font_color)
                print(user_theme.selected_tab_background)
            print(user.state)
            print(user.country_locale)
            print(user.fax)
            print(user.first_name)
            print(user.email)
            print(user.zip)
            print(user.decimal_separator)
            print(user.website)
            print(user.time_format)
            crm_profile = user.profile
            if crm_profile is not None:
                print(crm_profile.id)
                print(crm_profile.name)
            print(user.mobile)
            print(user.last_name)
            print(user.time_zone)
            print(user.zuid)
            print(user.is_confirm)
            print(user.full_name)
            print(user.phone)
            print(user.dob)
            print(user.date_format)
            print(user.status)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Get All Deactivated Users

# Get all deactive users
# ----------------------
def get_all_deactive_users(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_all_deactive_users()
        print(resp.status_code)
        users = resp.data
        for user in users:
            print("\n\n")
            print(user.id)
            print(user.name)
            print(user.signature)
            print(user.country)
            crm_role = user.role
            if crm_role is not None:
                print(crm_role.name)
                print(crm_role.id)
            customize_info = user.customize_info
            if customize_info is not None:
                print(customize_info.notes_desc)
                print(customize_info.is_to_show_right_panel)
                print(customize_info.is_bc_view)
                print(customize_info.is_to_show_home)
                print(customize_info.is_to_show_detail_view)
                print(customize_info.unpin_recent_item)
            print(user.city)
            print(user.name_format)
            print(user.language)
            print(user.locale)
            print(user.is_personal_account)
            print(user.default_tab_group)
            print(user.street)
            print(user.alias)
            user_theme = user.theme
            if user_theme is not None:
                print(user_theme.normal_tab_font_color)
                print(user_theme.normal_tab_background)
                print(user_theme.selected_tab_font_color)
                print(user_theme.selected_tab_background)
            print(user.state)
            print(user.country_locale)
            print(user.fax)
            print(user.first_name)
            print(user.email)
            print(user.zip)
            print(user.decimal_separator)
            print(user.website)
            print(user.time_format)
            crm_profile = user.profile
            if crm_profile is not None:
                print(crm_profile.id)
                print(crm_profile.name)
            print(user.mobile)
            print(user.last_name)
            print(user.time_zone)
            print(user.zuid)
            print(user.is_confirm)
            print(user.full_name)
            print(user.phone)
            print(user.dob)
            print(user.date_format)
            print(user.status)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
  
Get All Confirmed Users

# Get all confirmed users
# -----------------------
def get_all_confirmed_users(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_all_confirmed_users()
        print(resp.status_code)
        users = resp.data
        for user in users:
            print("\n\n")
            print(user.id)
            print(user.name)
            print(user.signature)
            print(user.country)
            crm_role = user.role
            if crm_role is not None:
                print(crm_role.name)
                print(crm_role.id)
            customize_info = user.customize_info
            if customize_info is not None:
                print(customize_info.notes_desc)
                print(customize_info.is_to_show_right_panel)
                print(customize_info.is_bc_view)
                print(customize_info.is_to_show_home)
                print(customize_info.is_to_show_detail_view)
                print(customize_info.unpin_recent_item)
            print(user.city)
            print(user.name_format)
            print(user.language)
            print(user.locale)
            print(user.is_personal_account)
            print(user.default_tab_group)
            print(user.street)
            print(user.alias)
            user_theme = user.theme
            if user_theme is not None:
                print(user_theme.normal_tab_font_color)
                print(user_theme.normal_tab_background)
                print(user_theme.selected_tab_font_color)
                print(user_theme.selected_tab_background)
            print(user.state)
            print(user.country_locale)
            print(user.fax)
            print(user.first_name)
            print(user.email)
            print(user.zip)
            print(user.decimal_separator)
            print(user.website)
            print(user.time_format)
            crm_profile = user.profile
            if crm_profile is not None:
                print(crm_profile.id)
                print(crm_profile.name)
            print(user.mobile)
            print(user.last_name)
            print(user.time_zone)
            print(user.zuid)
            print(user.is_confirm)
            print(user.full_name)
            print(user.phone)
            print(user.dob)
            print(user.date_format)
            print(user.status)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Get All Non-Confirmed Users

# Get all notconfirmed users
# --------------------------
def get_all_not_confirmed_users(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_all_not_confirmed_users()
        print(resp.status_code)
        users = resp.data
        for user in users:
            print("\n\n")
            print(user.id)
            print(user.name)
            print(user.signature)
            print(user.country)
            crm_role = user.role
            if crm_role is not None:
                print(crm_role.name)
                print(crm_role.id)
            customize_info = user.customize_info
            if customize_info is not None:
                print(customize_info.notes_desc)
                print(customize_info.is_to_show_right_panel)
                print(customize_info.is_bc_view)
                print(customize_info.is_to_show_home)
                print(customize_info.is_to_show_detail_view)
                print(customize_info.unpin_recent_item)
            print(user.city)
            print(user.name_format)
            print(user.language)
            print(user.locale)
            print(user.is_personal_account)
            print(user.default_tab_group)
            print(user.street)
            print(user.alias)
            user_theme = user.theme
            if user_theme is not None:
                print(user_theme.normal_tab_font_color)
                print(user_theme.normal_tab_background)
                print(user_theme.selected_tab_font_color)
                print(user_theme.selected_tab_background)
            print(user.state)
            print(user.country_locale)
            print(user.fax)
            print(user.first_name)
            print(user.email)
            print(user.zip)
            print(user.decimal_separator)
            print(user.website)
            print(user.time_format)
            crm_profile = user.profile
            if crm_profile is not None:
                print(crm_profile.id)
                print(crm_profile.name)
            print(user.mobile)
            print(user.last_name)
            print(user.time_zone)
            print(user.zuid)
            print(user.is_confirm)
            print(user.full_name)
            print(user.phone)
            print(user.dob)
            print(user.date_format)
            print(user.status)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Get All Deleted Users

# Get all deleted users
# ---------------------
def get_all_deleted_users(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_all_deleted_users()
        print(resp.status_code)
        users = resp.data
        for user in users:
            print("\n\n")
            print(user.id)
            print(user.name)
            print(user.signature)
            print(user.country)
            crm_role = user.role
            if crm_role is not None:
                print(crm_role.name)
                print(crm_role.id)
            customize_info = user.customize_info
            if customize_info is not None:
                print(customize_info.notes_desc)
                print(customize_info.is_to_show_right_panel)
                print(customize_info.is_bc_view)
                print(customize_info.is_to_show_home)
                print(customize_info.is_to_show_detail_view)
                print(customize_info.unpin_recent_item)
            print(user.city)
            print(user.name_format)
            print(user.language)
            print(user.locale)
            print(user.is_personal_account)
            print(user.default_tab_group)
            print(user.street)
            print(user.alias)
            user_theme = user.theme
            if user_theme is not None:
                print(user_theme.normal_tab_font_color)
                print(user_theme.normal_tab_background)
                print(user_theme.selected_tab_font_color)
                print(user_theme.selected_tab_background)
            print(user.state)
            print(user.country_locale)
            print(user.fax)
            print(user.first_name)
            print(user.email)
            print(user.zip)
            print(user.decimal_separator)
            print(user.website)
            print(user.time_format)
            crm_profile = user.profile
            if crm_profile is not None:
                print(crm_profile.id)
                print(crm_profile.name)
            print(user.mobile)
            print(user.last_name)
            print(user.time_zone)
            print(user.zuid)
            print(user.is_confirm)
            print(user.full_name)
            print(user.phone)
            print(user.dob)
            print(user.date_format)
            print(user.status)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Get All Active & Confirmed Users

# Get all activeconfirmed users
# -----------------------------

def get_all_active_confirmed_users(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_all_active_confirmed_users()
        print(resp.status_code)
        users = resp.data
        for user in users:
            print("\n\n")
            print(user.id)
            print(user.name)
            print(user.signature)
            print(user.country)
            crm_role = user.role
            if crm_role is not None:
                print(crm_role.name)
                print(crm_role.id)
            customize_info = user.customize_info
            if customize_info is not None:
                print(customize_info.notes_desc)
                print(customize_info.is_to_show_right_panel)
                print(customize_info.is_bc_view)
                print(customize_info.is_to_show_home)
                print(customize_info.is_to_show_detail_view)
                print(customize_info.unpin_recent_item)
            print(user.city)
            print(user.name_format)
            print(user.language)
            print(user.locale)
            print(user.is_personal_account)
            print(user.default_tab_group)
            print(user.street)
            print(user.alias)
            user_theme = user.theme
            if user_theme is not None:
                print(user_theme.normal_tab_font_color)
                print(user_theme.normal_tab_background)
                print(user_theme.selected_tab_font_color)
                print(user_theme.selected_tab_background)
            print(user.state)
            print(user.country_locale)
            print(user.fax)
            print(user.first_name)
            print(user.email)
            print(user.zip)
            print(user.decimal_separator)
            print(user.website)
            print(user.time_format)
            crm_profile = user.profile
            if crm_profile is not None:
                print(crm_profile.id)
                print(crm_profile.name)
            print(user.mobile)
            print(user.last_name)
            print(user.time_zone)
            print(user.zuid)
            print(user.is_confirm)
            print(user.full_name)
            print(user.phone)
            print(user.dob)
            print(user.date_format)
            print(user.status)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Get All Admin Users

# Get all admin users
# -------------------
def get_all_admin_users(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_all_admin_users()
        print(resp.status_code)
        users = resp.data
        for user in users:
            print("\n\n")
            print(user.id)
            print(user.name)
            print(user.signature)
            print(user.country)
            crm_role = user.role
            if crm_role is not None:
                print(crm_role.name)
                print(crm_role.id)
            customize_info = user.customize_info
            if customize_info is not None:
                print(customize_info.notes_desc)
                print(customize_info.is_to_show_right_panel)
                print(customize_info.is_bc_view)
                print(customize_info.is_to_show_home)
                print(customize_info.is_to_show_detail_view)
                print(customize_info.unpin_recent_item)
            print(user.city)
            print(user.name_format)
            print(user.language)
            print(user.locale)
            print(user.is_personal_account)
            print(user.default_tab_group)
            print(user.street)
            print(user.alias)
            user_theme = user.theme
            if user_theme is not None:
                print(user_theme.normal_tab_font_color)
                print(user_theme.normal_tab_background)
                print(user_theme.selected_tab_font_color)
                print(user_theme.selected_tab_background)
            print(user.state)
            print(user.country_locale)
            print(user.fax)
            print(user.first_name)
            print(user.email)
            print(user.zip)
            print(user.decimal_separator)
            print(user.website)
            print(user.time_format)
            crm_profile = user.profile
            if crm_profile is not None:
                print(crm_profile.id)
                print(crm_profile.name)
            print(user.mobile)
            print(user.last_name)
            print(user.time_zone)
            print(user.zuid)
            print(user.is_confirm)
            print(user.full_name)
            print(user.phone)
            print(user.dob)
            print(user.date_format)
            print(user.status)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Get All Active & Confirmed Admins

# Get all activeconfirmedadmin users
# ----------------------------------
def get_all_active_confirmed_admin_users(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_all_active_confirmed_admin_users()
        print(resp.status_code)
        users = resp.data
        for user in users:
            print("\n\n")
            print(user.id)
            print(user.name)
            print(user.signature)
            print(user.country)
            crm_role = user.role
            if crm_role is not None:
                print(crm_role.name)
                print(crm_role.id)
            customize_info = user.customize_info
            if customize_info is not None:
                print(customize_info.notes_desc)
                print(customize_info.is_to_show_right_panel)
                print(customize_info.is_bc_view)
                print(customize_info.is_to_show_home)
                print(customize_info.is_to_show_detail_view)
                print(customize_info.unpin_recent_item)
            print(user.city)
            print(user.name_format)
            print(user.language)
            print(user.locale)
            print(user.is_personal_account)
            print(user.default_tab_group)
            print(user.street)
            print(user.alias)
            user_theme = user.theme
            if user_theme is not None:
                print(user_theme.normal_tab_font_color)
                print(user_theme.normal_tab_background)
                print(user_theme.selected_tab_font_color)
                print(user_theme.selected_tab_background)
            print(user.state)
            print(user.country_locale)
            print(user.fax)
            print(user.first_name)
            print(user.email)
            print(user.zip)
            print(user.decimal_separator)
            print(user.website)
            print(user.time_format)
            crm_profile = user.profile
            if crm_profile is not None:
                print(crm_profile.id)
                print(crm_profile.name)
            print(user.mobile)
            print(user.last_name)
            print(user.time_zone)
            print(user.zuid)
            print(user.is_confirm)
            print(user.full_name)
            print(user.phone)
            print(user.dob)
            print(user.date_format)
            print(user.status)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Add a User

# Create user
# -----------
def create_user(self):
    try:
        user_ins = zcrmsdk.ZCRMUser.get_instance()
        user_ins.last_name = "user1"
        user_ins.email = 'usermail1@domaim.com'
        user_ins.role = zcrmsdk.ZCRMRole.get_instance(3477061000000, 'CEO')# role id and role name
        user_ins.profile = zcrmsdk.ZCRMProfile.get_instance(347706100000, 'Administrator')# profile id and profile name
        resp = zcrmsdk.ZCRMOrganization.get_instance().create_user(user_ins)
        print(resp.status_code)
        print(resp.message)
        print(resp.code)
        print(resp.status)
        print(resp.details)
        print(resp.data)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Update User Details

# Update user
# -----------
def update_user(self):
    try:
        user_ins = zcrmsdk.ZCRMUser.get_instance(347706100000, 'user1') # user id and user name
        user_ins.first_name = "user"
        resp = zcrmsdk.ZCRMOrganization.get_instance().update_user(user_ins)
        print(resp.status_code)
        print(resp.message)
        print(resp.code)
        print(resp.status)
        print(resp.details)
        print(resp.data)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Delete User Details

# Delete user
# -----------
def delete_user(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().delete_user(347706100000) # user id
        print(resp.status_code)
        print(resp.message)
        print(resp.code)
        print(resp.status)
        print(resp.details)
        print(resp.data)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Get Current User Details

# Get current user
# ----------------
def get_current_user(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_current_user()
        print(resp.status_code)
        users = resp.data
        for user in users:
            print("\n\n")
            print(user.id)
            print(user.name)
            print(user.signature)
            print(user.country)
            crm_role = user.role
            if crm_role is not None:
                print(crm_role.name)
                print(crm_role.id)
            customize_info = user.customize_info
            if customize_info is not None:
                print(customize_info.notes_desc)
                print(customize_info.is_to_show_right_panel)
                print(customize_info.is_bc_view)
                print(customize_info.is_to_show_home)
                print(customize_info.is_to_show_detail_view)
                print(customize_info.unpin_recent_item)
            print(user.city)
            print(user.name_format)
            print(user.language)
            print(user.locale)
            print(user.is_personal_account)
            print(user.default_tab_group)
            print(user.street)
            print(user.alias)
            user_theme = user.theme
            if user_theme is not None:
                print(user_theme.normal_tab_font_color)
                print(user_theme.normal_tab_background)
                print(user_theme.selected_tab_font_color)
                print(user_theme.selected_tab_background)
            print(user.state)
            print(user.country_locale)
            print(user.fax)
            print(user.first_name)
            print(user.email)
            print(user.zip)
            print(user.decimal_separator)
            print(user.website)
            print(user.time_format)
            crm_profile = user.profile
            if crm_profile is not None:
                print(crm_profile.id)
                print(crm_profile.name)
            print(user.mobile)
            print(user.last_name)
            print(user.time_zone)
            print(user.zuid)
            print(user.is_confirm)
            print(user.full_name)
            print(user.phone)
            print(user.dob)
            print(user.date_format)
            print(user.status)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Profiles
Get All Profiles

# Get all profiles
# ----------------
def get_profiles(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_all_profiles()
        profiles = resp.data
        print(resp.status_code)
        for profile in profiles:
            print("\n\n")
            print(profile.name)
            print(profile.id)
            print(profile.is_default)
            print(profile.created_time)
            print(profile.modified_time)
            print(profile.modified_by)
            print(profile.description)
            print(profile.created_by)
            print(profile.category)
            permissions = profile.permissions
            if permissions is not None:
                print(":::PERMISSIONS:::")
                for permission in permissions:
                    print(permission.name)
                    print(permission.id)
                    print(permission.display_label)
                    print(permission.module)
                    print(permission.is_enabled)
            sections = profile.sections
            if sections is not None:
                for section in sections:
                    print(section.name)
                    categories = section.categories
                    if categories is not None:
                        print("::::CATEGORIES:::")
                        for category in categories:
                            print(category.name)
                            print(category.display_label)
                            print(category.permission_ids)
                            print(category.module)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Get Profile Data

# Get single profile data
# -----------------------
def get_profile(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_profile(337216400) # 337216400 is profile id
        profiles = [resp.data]
        print(resp.status_code)
        for profile in profiles:
            print(profile.name)
            print(profile.id)
            print(profile.is_default)
            print(profile.created_time)
            print(profile.modified_time)
            print(profile.modified_by)
            print(profile.description)
            print(profile.created_by)
            print(profile.category)
            permissions = profile.permissions
            if permissions is not None:
                print(":::PERMISSIONS:::")
                for permission in permissions:
                    print(permission.name)
                    print(permission.id)
                    print(permission.display_label)
                    print(permission.module)
                    print(permission.is_enabled)
            sections = profile.sections
            if sections is not None:
                for section in sections:
                    print(section.name)
                    categories = section.categories
                    if categories is not None:
                        print("::::CATEGORIES:::")
                        for category in categories:
                            print(category.name)
                            print(category.display_label)
                            print(category.permission_ids)
                            print(category.module)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Roles
Get All Roles

# Get all roles
# -------------
def get_roles(self):
    try:
        resp = zcrmsdk.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 zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Get Role Data

# Get single role data
# --------------------
def get_role(self):
    try:
        resp = zcrmsdk.ZCRMOrganization.get_instance().get_role(3372164000000026008)
        roles = [resp.data]
        print(resp.status_code)
        for role in roles:
            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 zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
 
Variables
Get Variable Groups

def get_variable_groups(self):
    try:
        variable_groups_response = zcrmsdk.ZCRMOrganization.get_instance().get_variable_groups()
        variable_groups = variable_groups_response.data
		for variable_group in variable_groups:
            print(variable_group.id)
            print(variable_group.name)
            print(variable_group.api_name)
            print(variable_group.display_label)
            print(variable_group.description)

    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
Get Variables

def get_variables(self):
    try:
        variables_response = zcrmsdk.ZCRMOrganization.get_instance().get_variables()
        variables = variables_response.data
        for variable in variables:
            print(variable.id)
            print(variable.name)
            print(variable.api_name)
            print(variable.value)
            print(variable.type)
            print(variable.description)
            print(variable.variable_group.id)
            print(variable.variable_group.api_name)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
Create Variables

def create_variables(self):
    try:
        variables_list = list()
        for i in range(0,2):
            variable_ins = zcrmsdk.ZCRMVariable.get_instance()
            variable_ins.name = 'Name' + str(i)
            variable_ins.api_name = 'APIName' + str(i)
            variable_ins.description = 'Python SDK variable ' + str(i)
            variable_ins.type = 'text'
            variable_ins.value = 'value' + str(i)
            variable_group_ins = zcrmsdk.ZCRMVariableGroup.get_instance()
            variable_group_ins.id = '525508000001554536'
            variable_ins.variable_group = variable_group_ins
            variables_list.append(variable_ins)
        variables_response = zcrmsdk.ZCRMOrganization.get_instance().create_variables(variables_list)
        entity_responses = variables_response.bulk_entity_response
        for entity_response in entity_responses:
            print(entity_response.details)
            print(entity_response.status)
            print(entity_response.message)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
Update Variables

def update_variables(self):
    try:
        variables_list = list()
        variable_ins_1 = zcrmsdk.ZCRMVariable.get_instance()
        variable_ins_1.id = '525508000004174011'
        variable_ins_1.description = 'Updated description'
        variable_ins_1.value = 'Updated value'
        variables_list.append(variable_ins_1)

        variable_ins_2 = zcrmsdk.ZCRMVariable.get_instance()
        variable_ins_2.id = '525508000004174012'
        variable_ins_2.type = 'integer'
        variable_ins_2.value = 5
        variables_list.append(variable_ins_2)

        variables_response = zcrmsdk.ZCRMOrganization.get_instance().update_variables(variables_list)
        entity_responses = variables_response.bulk_entity_response
        for entity_response in entity_responses:
            print(entity_response.details)
            print(entity_response.status)
            print(entity_response.message)
    except zcrmsdk.ZCRMException as ex:
        print(ex.status_code)
        print(ex.error_message)
        print(ex.error_code)
        print(ex.error_details)
        print(ex.error_content)
Taxes
Get Taxes

def get_organization_taxes(self):
	try:
		resp = ZCRMOrganization.get_instance().get_organization_taxes()
		org_taxes = resp.data
		for org_tax in org_taxes:
		    print ("\n\n")
		    print (org_tax.id)
		    print (org_tax.name)
		    print(org_tax.display_label)
		    print(org_tax.value)
	except ZCRMException as ex:
	    print (ex.status_code)
	    print (ex.error_message)
	    print (ex.error_code)
	    print (ex.error_details)
	    print (ex.error_content)
Get Specific Tax

def get_organization_tax(self):
	try:
		resp = ZCRMOrganization.get_instance().get_organization_tax('3524033000002953035')
		org_tax = resp.data
		print ("\n\n")
		print (org_tax.id)
		print (org_tax.name)
		print(org_tax.display_label)
		print(org_tax.value)
    except ZCRMException as ex:
        print (ex.status_code)
        print (ex.error_message)
        print (ex.error_code)
        print (ex.error_details)
        print (ex.error_content)
Create Taxes

def create_organization_taxes(self):
	try:
		orgtax_ins_list = list()
		orgtax=ZCRMOrgTax.get_instance()
		orgtax.name ='assddasdsd'
		orgtax.value = 23
		orgtax_ins_list.append(orgtax)
		orgtax1 = ZCRMOrgTax.get_instance()
		orgtax1.name = 'asd2sd3sdasd'
		orgtax1.value = 24
		orgtax_ins_list.append(orgtax1)
		resp = ZCRMOrganization.get_instance().create_organization_taxes(orgtax_ins_list)
		print (resp)
		print(resp.bulk_entity_response)
		entity_responses = resp.bulk_entity_response
		for entity_response in entity_responses:
		    print (entity_response.details)
		    print (entity_response.status)
		    print (entity_response.message)
		    print (entity_response.code)
	except ZCRMException as ex:
		print( ex.status_code)
		print( ex.error_message)
		print( ex.error_code)
		print( ex.error_details)
		print( ex.error_content)
Update Taxes

def update_organization_taxes(self):
	try:
		orgtax_ins_list = list()
		orgtax=ZCRMOrgTax.get_instance()
		orgtax.id = '3524033000002953037'
		orgtax.name ='asasdadda'
		orgtax.value = 23
		orgtax_ins_list.append(orgtax)
		orgtax1 = ZCRMOrgTax.get_instance()
		orgtax1.id = '3524033000002953039'
		orgtax1.name = 'asd2dfdasd'
		orgtax1.value = 24
		orgtax_ins_list.append(orgtax1)
		resp = ZCRMOrganization.get_instance().update_organization_taxes(orgtax_ins_list)
		print (resp)
		print(resp.bulk_entity_response)
		entity_responses = resp.bulk_entity_response
		for entity_response in entity_responses:
		    print (entity_response.details)
		    print (entity_response.status)
		    print (entity_response.message)
		    print (entity_response.code)
	except ZCRMException as ex:
	    print( ex.status_code)
	    print( ex.error_message)
	    print( ex.error_code)
	    print( ex.error_details)
	    print( ex.error_content)
Delete Taxes

def delete_organization_taxes(self):
	try:
		orgtax_ids= list()
		orgtax_ids.append('3524033000002953045')
		orgtax_ids.append('3524033000002953043')
		resp = ZCRMOrganization.get_instance().delete_organization_taxes(orgtax_ids)
		print(resp.bulk_entity_response)
		entity_responses = resp.bulk_entity_response
		for entity_response in entity_responses:
		    print (entity_response.details)
		    print (entity_response.status)
		    print (entity_response.message)
		    print (entity_response.code)
	except ZCRMException as ex:
	    print( ex.status_code)
	    print( ex.error_message)
	    print( ex.error_code)
	    print( ex.error_details)
	    print( ex.error_content)
Delete Specific Tax

def delete_organization_tax(self):
	try:
		resp = ZCRMOrganization.get_instance().delete_organization_tax('3524033000002953039')
		resp.status_code
		print (resp.code)
		print (resp.details)
		print (resp.message)
		print (resp.status)
    except ZCRMException as ex:
        print( ex.status_code)
        print( ex.error_message)
        print( ex.error_code)
        print( ex.error_details)
        print( ex.error_content)