Python SDKのサンプルコード - メモの操作
メモの添付ファイルの取得
def note_get_attachments(self):
try:
note=ZCRMNote.get_instance(None,"1386586000001856002")
resp=note.get_attachments()
print(resp.status_code)
attachment_ins_arr=resp.data
for attachment_ins in attachment_ins_arr:
print (attachment_ins.id)
print (attachment_ins.file_name)
print (attachment_ins.file_type)
print (attachment_ins.size)
print (attachment_ins.owner.id)
print (attachment_ins.created_by.id)
print (attachment_ins.modified_by.id)
print (attachment_ins.created_time)
print( attachment_ins.modified_time)
print (attachment_ins.parent_module)
print (attachment_ins.attachment_type)
print (attachment_ins.parent_name)
print (attachment_ins.parent_id)
print (attachment_ins.parent_record.entity_id)
print ("\n\n")
except ZCRMException as ex:
print (ex.status_code)
print (ex.error_message)
print( ex.error_code)
print( ex.error_details)
print (ex.error_content)
メモの添付ファイルのアップロード
def note_upload_attachment(self):
try:
note = ZCRMNote.get_instance(None, "1386586000001856002")
resp=note.upload_attachment('/Users/asdad/Documents/index.html')
print (resp.data.id)
print (resp.status_code)
print (resp.code)
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)
メモの添付ファイルのダウンロード
def note_download_attachment(self):
try:
note = ZCRMNote.get_instance(None, "1386586000001856002")
resp=note.download_attachment("1386586000001856002")
print (resp.response_headers)
if resp.status_code == 200:
f = open(resp.file_name, "w")
for chunk in resp.response:
f.write(chunk)
f.close()
except ZCRMException as ex:
print (ex.status_code)
print (ex.error_message)
print (ex.error_code)
print (ex.error_details)
print (ex.error_content)
メモの添付ファイルの削除
def note_delete_attachment(self):
try:
note = ZCRMNote.get_instance(None, "1386586000001856002")
resp=note.delete_attachment("1386586000001856002")
print(resp.status_code)
print(resp.code)
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)