用python编写的dynamics365crm的api包装器
dynamics365crm-python的Python项目详细描述
#动态365crm python 用python编写的dynamics365crm-api包装器。 此库适用于API版本:v9.0
##安装 ` pip install dynamics365crm-python `
##用法 如果您不使用OAuth身份验证,并且您已经有一个访问令牌,请按如下方式调用库: -resource=CRM的URL,例如:https://example.crm2.dynamics.com/` from dynamics365crm.client import Client client = Client('RESOURCE', 'ACCESS_TOKEN') `
如果您将使用OAuth身份验证调用库,如下所示: ` from dynamics365crm.client import Client client = Client('RESOURCE', CLIENT_ID', 'CLIENT_SECRET') `
####获取授权URL ` url = client.url_petition("REDIRECT_URL") `
####将代码交换为访问令牌 ` token = client.exchange_code('REDIRECT_URL', 'CODE') `
####刷新令牌 ` token = client.refresh_token('REFRESH TOKEN', 'REDIRECT_URL') `
####设置令牌 ` token = client.set_token('TOKEN') `
###联系人部分 -参见文档https://docs.microsoft.com/es-es/dynamics365/customer-engagement/web-api/contact?view=dynamics-ce-odata-9
####获取联系人 可以接收orderby、filter、select、top、expand ` list_contacts = client.get_contacts() `
####创建联系人 ` create_contact = client.create_contact(firstname="FIRSTNAME",lastname="LASTNAME",middlename="MIDDLENAME",emailaddress1="EMAILADDRESS") `
####删除联系人 ` delete_contact = client.delete_contact('ID') `
####更新联系人 ` update_contact = client.update_contact('ID',firstname="FIRSTNAME",lastname="LASTNAME",middlename="MIDDLENAME",emailaddress1="EMAILADDRESS") `
###会计科 -参见文档https://docs.microsoft.com/es-es/dynamics365/customer-engagement/web-api/account?view=dynamics-ce-odata-9
####获取帐户 可以接收orderby、filter、select、top、expand ` get_accounts = client.get_accounts() `
####创建帐户 ` create_account = client.create_account(name="NAME",websiteurl="WWW.WEBSITE.COM") `
####删除帐户 ` create_account = client.delete_account('ID') `
####更新帐户 ` update_account = client.update_account(id="ID",name="NAME") `
###机会科 -请参阅文档https://docs.microsoft.com/es-es/dynamics365/customer-engagement/web-api/opportunity?view=dynamics-ce-odata-9
####获得机会 可以接收orderby、filter、select、top、expand ` list_opportunities = client.get_opportunities() `
####创造机会 ` create_opportunities = client.create_opportunity(name="OPPORTUNITY NAME") `
####删除机会 ` delete_opportunities = client.delete_opportunity(id="OPPORTUNITY ID") `
####更新机会 ` update_opportunities = client.update_opportunity(id="OPPORTUNITY ID", name="OPPORTUNITY NAME", description="SOME DESCRIPTION") `
###导联部分 -请参阅文档https://docs.microsoft.com/es-es/dynamics365/customer-engagement/web-api/lead?view=dynamics-ce-odata-9
####获取线索 可以接收orderby、filter、select、top、expand ` list_leads = client.get_leads() `
####创建潜在客户 ` create_leads = client.create_lead(fullname="LEAD NAME", subject="LEAD SUBJECT", mobilephone="123456",websiteurl="WWW.WEBSITE.COM",middlename="MIDDLE LEAD NAME") `
####删除潜在客户 ` delete_leads = client.delete_lead("ID") `
####更新潜在客户 ` update_leads = client.update_lead(fullname="LEAD NAME", subject="LEAD SUBJECT", mobilephone="123456",websiteurl="WWW.WEBSITE.COM",middlename="MIDDLE LEAD NAME") `
###活动部分 -请参阅文档https://docs.microsoft.com/es-es/dynamics365/customer-engagement/web-api/campaign?view=dynamics-ce-odata-9
####获取活动 可以接收orderby、filter、select、top、expand ` list_campaigns = client.get_campaigns() `
####创建活动 ` create_campaign = client.create_campaign(name="CAMPAIGN NAME", description="SOME DESCRIPTION") `
####删除活动 ` delete_campaign = client.delete_campaign(id="ID") `
####更新活动 ` update_campaign = client.update_campaign(id="ID",name="CAMPAIGN NAME", description="SOME DESCRIPTION") `
##要求 -请求
##测试 ` dynamics365crm/test.py `