Skip to content

Commit eef7ddb

Browse files
authored
Merge pull request #6 from zoho/beta
Beta
2 parents 743040b + acaa69e commit eef7ddb

File tree

2,124 files changed

+235520
-83
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,124 files changed

+235520
-83
lines changed

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,35 @@ License
2525

2626
## Latest Version
2727

28+
- [5.0.0](/versions/5.0.0/README.md)
29+
- Updated dependencies in `setup.py` and `requirements.txt` files.
30+
- Handled SDK utils.
31+
- Improved DB store query handling.
32+
- Fixed an issue with the Blueprint update API response.
33+
- Blueprint Field class `validationRule` field datatype changed (String to Object).
34+
- BulkWrite `BodyWrapper` class `fileType` field datatype changed (Choice to String).
35+
- BulkWrite `JobDetail` class `fileType` field datatype changed (Choice to String).
36+
- BulkRead `Query` class `fileType` field datatype changed (Choice to String).
37+
- Modules `GetModulesParam` class `STATUS` field datatype changed (Choice to String).
38+
- Added new `trigger` field in Notes `BodyWrapper` class.
39+
- Notifications class `deleteEvents` field datatype changed (Choice to String).
40+
- Modules `DeleteNotificationParam` class `CHANNEL_IDS` field datatype changed (Long to String).
41+
- Profiles and `MinifiedProfile` class `delete` field datatype changed (Boolean to `Delete` class).
42+
- Added new `applyFeatureExecution`, `applyValidationRule`, `applyFunctionValidationRule`, and `skipFeatureExecution` fields in Record `BodyWrapper` class.
43+
- Tags class `colorCode` field datatype changed (Choice to String).
44+
- Users `CountWrapper` class `count` field datatype changed (Long to Integer).
45+
- Users `GetUsersParam` class `TYPE` field datatype changed (Choice to String).
46+
- Webforms `Abtesting` class `id` field datatype changed (Long to String).
47+
- Webforms `AcknowledgeVisitor` class `templateId` field datatype changed (Long to String).
48+
- Webforms `AssignmentRule` class `id` field datatype changed (Long to String).
49+
- Webforms `Layout` class `id` field datatype changed (Long to String).
50+
- Webforms `Module` class `id` field datatype changed (Long to String).
51+
- Webforms `Owner` class `id` field datatype changed (Long to String).
52+
- Webforms `Tags` class `id` field datatype changed (Long to String).
53+
- Webforms `Users` class `id` field datatype changed (Long to String).
54+
- Webforms `Users` `acknowledgeVisitor` field datatype changed (AcknowledgeVisitors to AcknowledgeVisitor).
55+
- Removed `updateWebForms` method from the `WebformsOperations` class.
56+
2857
- [4.0.0](/versions/4.0.0/README.md)
2958
- Added `mysql-connector-python` as an optional dependency via `extras_require` in `setup.py`.
3059
- Users who require MySQL support can now install it using `pip install zohocrmsdk8-0[mysql]`
@@ -56,7 +85,7 @@ For older versions, please [refer](https://github.com/zoho/zohocrm-python-sdk-8.
5685
## Including the SDK in your project
5786
You can include the SDK to your project using:
5887

59-
- For including the latest [version](https://github.com/zoho/zohocrm-python-sdk-8.0/releases/tag/3.0.0)
88+
- For including the latest [version](https://github.com/zoho/zohocrm-python-sdk-8.0/releases/tag/5.0.0)
6089

6190
- Install **Python** from [python.org](https://www.python.org/downloads/) (if not installed).
6291

@@ -83,4 +112,4 @@ For example, if you generate the tokens for your Sandbox environment in the CN d
83112

84113
---
85114

86-
For more details, kindly refer [here](/versions/3.0.0/README.md).
115+
For more details, kindly refer [here](/versions/5.0.0/README.md).

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
setuptools~=70.0.0
2-
requests~=2.32.2
3-
urllib3~=2.5.0
4-
python-dateutil~=2.8.2
1+
setuptools==80.9.0
2+
requests==2.32.4
3+
urllib3==2.6.0
4+
python-dateutil==2.8.2
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
from zohocrmsdk.src.com.zoho.api.authenticator import OAuthToken
2+
from zohocrmsdk.src.com.zoho.crm.api import Initializer
3+
from zohocrmsdk.src.com.zoho.crm.api.blueprint import BlueprintOperations, ResponseWrapper, APIException
4+
from zohocrmsdk.src.com.zoho.crm.api.dc import INDataCenter
5+
6+
7+
class GetBlueprint(object):
8+
9+
@staticmethod
10+
def initialize():
11+
environment = INDataCenter.PRODUCTION()
12+
token = OAuthToken(client_id="client_id", client_secret="client_secret", grant_token="grant_token")
13+
Initializer.initialize(environment, token)
14+
15+
@staticmethod
16+
def get_blueprint(module_api_name, record_id):
17+
"""
18+
This method is used to get a single record's Blueprint details with ID and print the response.
19+
:param module_api_name: The API Name of the record's module
20+
:param record_id: The ID of the record to get Blueprint
21+
"""
22+
"""
23+
example
24+
module_api_name = "Leads"
25+
record_id = 3409643000002469044
26+
"""
27+
blueprint_operations = BlueprintOperations(record_id, module_api_name)
28+
response = blueprint_operations.get_blueprint()
29+
if response is not None:
30+
print('Status Code: ' + str(response.get_status_code()))
31+
if response.get_status_code() in [204, 304]:
32+
print('No Content' if response.get_status_code() == 204 else 'Not Modified')
33+
return
34+
response_object = response.get_object()
35+
if response_object is not None:
36+
if isinstance(response_object, ResponseWrapper):
37+
blueprint = response_object.get_blueprint()
38+
process_info = blueprint.get_process_info()
39+
if process_info is not None:
40+
print("ProcessInfo ID: " + process_info.get_id())
41+
print("ProcessInfo Field-ID: " + str(process_info.get_field_id()))
42+
print("ProcessInfo isContinuous: " + str(process_info.get_is_continuous()))
43+
print("ProcessInfo API Name: " + process_info.get_api_name())
44+
print("ProcessInfo Continuous: " + str(process_info.get_continuous()))
45+
print("ProcessInfo FieldLabel: " + process_info.get_field_label())
46+
print("ProcessInfo Name: " + process_info.get_name())
47+
print("ProcessInfo ColumnName: " + process_info.get_column_name())
48+
print("ProcessInfo FieldValue: " + process_info.get_field_value())
49+
print("ProcessInfo FieldName: " + process_info.get_field_name())
50+
print("ProcessInfo FieldName: " + str(process_info.get_escalation()))
51+
transitions = blueprint.get_transitions()
52+
for transition in transitions:
53+
next_transitions = transition.get_next_transitions()
54+
for next_transition in next_transitions:
55+
print("NextTransition ID: ")
56+
print(next_transition.get_id())
57+
print("NextTransition Name: " + next_transition.get_name())
58+
data = transition.get_data()
59+
if data is not None:
60+
print("Record ID: " + str(data.get_id()))
61+
created_by = data.get_created_by()
62+
if created_by is not None:
63+
print("Record Created By - Name: " + created_by.get_name())
64+
print("Record Created By - ID: " + created_by.get_id())
65+
print("Record CreatedTime: " + str(data.get_created_time()))
66+
if data.get_modified_time() is not None:
67+
print("Record ModifiedTime: " + str(data.get_modified_time()))
68+
modified_by = data.get_modified_by()
69+
if modified_by is not None:
70+
print("Record Modified By - Name: " + modified_by.get_name())
71+
print("Record Modified By - ID: " + modified_by.get_id())
72+
tags = data.get_tag()
73+
if tags is not None:
74+
for tag in tags:
75+
print("Record Tag Name: " + tag.get_name())
76+
print("Record Tag ID: " + tag.get_id())
77+
for key, value in data.get_key_values().items():
78+
print(key + " : " + str(value))
79+
print("Transition NextFieldValue: " + str(transition.get_next_field_value()))
80+
print("Transition Name: " + str(transition.get_name()))
81+
print("Transition CriteriaMatched: " + str(transition.get_criteria_matched()))
82+
print("Transition ID: " + str(transition.get_id()))
83+
print("Transition Execution Time: " + str(transition.get_execution_time()))
84+
print("Transition CriteriaMessage: " + str(transition.get_criteria_message()))
85+
fields = transition.get_fields()
86+
print("Transition Fields")
87+
for field in fields:
88+
print("Webhook: " + str(field.get_webhook()))
89+
print("JsonType: " + str(field.get_json_type()))
90+
print("DisplayLabel: " + field.get_display_label())
91+
print("SystemMandatory: " + str(field.get_system_mandatory()))
92+
print("DataType: " + field.get_data_type())
93+
print("ColumnName: " + str(field.get_column_name()))
94+
print("PersonalityName: " + str(field.get_personality_name()))
95+
print("ID: " + str(field.get_id()))
96+
print("TransitionSequence: " + str(field.get_transition_sequence()))
97+
if field.get_mandatory() is not None:
98+
print("Mandatory: " + str(field.get_mandatory()))
99+
layout = field.get_layouts()
100+
if layout is not None:
101+
print("Layout ID: " + str(layout.get_id()))
102+
print("Layout Name: " + str(layout.get_name()))
103+
print("APIName : " + str(field.get_api_name()))
104+
print("Content: " + str(field.get_content()))
105+
crypt = field.get_crypt()
106+
if crypt is not None:
107+
print("Crypt Details")
108+
print("Mode: " + crypt.get_mode())
109+
print("Column: " + crypt.get_column())
110+
print("Table: " + crypt.get_table())
111+
print("Status: " + str(crypt.get_status()))
112+
print("FieldLabel: " + str(field.get_field_label()))
113+
tool_tip = field.get_tooltip()
114+
if tool_tip is not None:
115+
print("ToolTip Name: " + tool_tip.get_name())
116+
print("ToolTip Value: " + tool_tip.get_value())
117+
print("CreatedSource: " + str(field.get_created_source()))
118+
print("FieldReadOnly: " + str(field.get_field_read_only()))
119+
elif isinstance(response_object, APIException):
120+
print("Status: " + response_object.get_status().get_value())
121+
print("Code: " + response_object.get_code().get_value())
122+
print("Details")
123+
details = response_object.get_details()
124+
for key, value in details.items():
125+
print(key + ' : ' + str(value))
126+
print("Message: " + response_object.get_message().get_value())
127+
128+
129+
GetBlueprint.initialize()
130+
GetBlueprint.get_blueprint(module_api_name="Leads", record_id="1055806000028448052")
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
from zohocrmsdk.src.com.zoho.api.authenticator import OAuthToken
2+
from zohocrmsdk.src.com.zoho.crm.api import Initializer
3+
from zohocrmsdk.src.com.zoho.crm.api.blueprint import BlueprintOperations, BodyWrapper, BluePrint, SuccessResponse, APIException
4+
from zohocrmsdk.src.com.zoho.crm.api.record import Record
5+
from zohocrmsdk.src.com.zoho.crm.api.dc import USDataCenter
6+
7+
8+
class UpdateBlueprint(object):
9+
10+
@staticmethod
11+
def initialize():
12+
environment = USDataCenter.PRODUCTION()
13+
token = OAuthToken(client_id="client_id", client_secret="client_secret", grant_token="grant_token")
14+
Initializer.initialize(environment, token)
15+
16+
@staticmethod
17+
def update_blueprint(module_api_name, record_id, transition_id):
18+
"""
19+
This method is used to update a single record's Blueprint details with ID and print the response.
20+
:param module_api_name: The API Name of the record's module
21+
:param record_id: The ID of the record to update Blueprint
22+
:param transition_id: The ID of the Blueprint transition Id
23+
"""
24+
"""
25+
example
26+
module_api_name = "Leads"
27+
record_id = 3409643000002469044
28+
transition_id = 3409643000001172075
29+
"""
30+
blueprint_operations = BlueprintOperations(record_id, module_api_name)
31+
request = BodyWrapper()
32+
blueprint_list = []
33+
blueprint = BluePrint()
34+
blueprint.set_transition_id(transition_id)
35+
data = Record()
36+
lookup = dict()
37+
lookup['id'] = '8940372937'
38+
data.add_key_value('lookup', lookup)
39+
data.add_key_value('Phone', '8940372937')
40+
data.add_key_value("Notes", "Updated via blueprint")
41+
check_list_item = {'item1': True}
42+
check_list_item_2 = {'item1': True}
43+
check_list_item_3 = {'item1': True}
44+
check_lists = [check_list_item, check_list_item_2, check_list_item_3]
45+
data.add_key_value("CheckLists", check_lists)
46+
blueprint.set_data(data)
47+
blueprint_list.append(blueprint)
48+
request.set_blueprint(blueprint_list)
49+
response = blueprint_operations.update_blueprint(request)
50+
if response is not None:
51+
print('Status Code: ' + str(response.get_status_code()))
52+
response_object = response.get_object()
53+
if response_object is not None:
54+
if isinstance(response_object, SuccessResponse):
55+
print("Status: " + response_object.get_status().get_value())
56+
print("Code: " + response_object.get_code().get_value())
57+
print("Details")
58+
details = response_object.get_details()
59+
for key, value in details.items():
60+
print(key + ' : ' + str(value))
61+
print("Message: " + response_object.get_message().get_value())
62+
elif isinstance(response_object, APIException):
63+
print("Status: " + response_object.get_status().get_value())
64+
print("Code: " + response_object.get_code().get_value())
65+
print("Details")
66+
details = response_object.get_details()
67+
for key, value in details.items():
68+
print(key + ' : ' + str(value))
69+
print("Message: " + response_object.get_message().get_value())
70+
71+
72+
UpdateBlueprint.initialize()
73+
UpdateBlueprint.update_blueprint(module_api_name="Leads", record_id="1055806000028448052", transition_id="1055806000000173093")
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import os
2+
3+
from zohocrmsdk.src.com.zoho.crm.api.modules import MinifiedModule
4+
from zohocrmsdk.src.com.zoho.crm.api.fields import MinifiedField
5+
from zohocrmsdk.src.com.zoho.api.authenticator import OAuthToken
6+
from zohocrmsdk.src.com.zoho.crm.api import Initializer
7+
from zohocrmsdk.src.com.zoho.crm.api.bulk_read import BulkReadOperations, BodyWrapper, CallBack, Query, Criteria, \
8+
ActionWrapper, SuccessResponse, APIException
9+
from zohocrmsdk.src.com.zoho.crm.api.util import Choice
10+
from zohocrmsdk.src.com.zoho.crm.api.dc import INDataCenter
11+
12+
13+
class CreateBulkReadJob(object):
14+
15+
@staticmethod
16+
def initialize():
17+
environment = INDataCenter.PRODUCTION()
18+
token = OAuthToken(client_id="client_id", client_secret="client_secret", grant_token="grant_token")
19+
Initializer.initialize(environment, token)
20+
21+
@staticmethod
22+
def create_bulk_read_job(module_api_name):
23+
"""
24+
This method is used to create a bulk read job to export records.
25+
:param module_api_name: The API Name of the record's module
26+
"""
27+
"""
28+
example
29+
module_api_name = 'Leads'
30+
"""
31+
bulk_read_operations = BulkReadOperations()
32+
request = BodyWrapper()
33+
call_back = CallBack()
34+
call_back.set_url("https://www.example.com/callback")
35+
call_back.set_method(Choice('post'))
36+
request.set_callback(call_back)
37+
query = Query()
38+
module = MinifiedModule()
39+
module.set_api_name(module_api_name)
40+
query.set_module(module)
41+
field_api_names = ['Last_Name']
42+
query.set_fields(field_api_names)
43+
query.set_page(1)
44+
criteria = Criteria()
45+
field = MinifiedField()
46+
field.set_api_name('Created_Time')
47+
criteria.set_field(field)
48+
criteria.set_comparator(Choice('between'))
49+
time = ["2020-06-03T17:31:48+05:30", "2020-06-03T17:31:48+05:30"]
50+
criteria.set_value(time)
51+
query.set_criteria(criteria)
52+
request.set_query(query)
53+
response = bulk_read_operations.create_bulk_read_job(request)
54+
if response is not None:
55+
print('Status Code: ' + str(response.get_status_code()))
56+
response_object = response.get_object()
57+
if response_object is not None:
58+
if isinstance(response_object, ActionWrapper):
59+
action_response_list = response_object.get_data()
60+
for action_response in action_response_list:
61+
if isinstance(action_response, SuccessResponse):
62+
print("Status: " + action_response.get_status().get_value())
63+
print("Code: " + action_response.get_code().get_value())
64+
print("Details")
65+
details = action_response.get_details()
66+
for key, value in details.items():
67+
print(key + ' : ' + str(value))
68+
print("Message: " + action_response.get_message().get_value())
69+
elif isinstance(action_response, APIException):
70+
print("Status: " + action_response.get_status().get_value())
71+
print("Code: " + action_response.get_code().get_value())
72+
print("Details")
73+
details = action_response.get_details()
74+
for key, value in details.items():
75+
print(key + ' : ' + str(value))
76+
print("Message: " + action_response.get_message().get_value())
77+
elif isinstance(response_object, APIException):
78+
print("Status: " + response_object.get_status().get_value())
79+
print("Code: " + response_object.get_code().get_value())
80+
print("Details")
81+
details = response_object.get_details()
82+
for key, value in details.items():
83+
print(key + ' : ' + str(value))
84+
print("Message: " + response_object.get_message())
85+
86+
87+
CreateBulkReadJob.initialize()
88+
CreateBulkReadJob.create_bulk_read_job(module_api_name='Leads')

0 commit comments

Comments
 (0)