Dynamics365CRM API wrapper for Dynamics 365 written in Python. This library works for API version: v9.0
pip install dynamics365crm-python
If you will not use the oauth authentication and you already have an access token, call the library like this:
- resource = the url of the CRM, example: https://example.crm2.dynamics.com/
from dynamics365crm.client import Client
client = Client('RESOURCE', 'ACCESS_TOKEN')
If you will use the oauth authentication call the library like this:
from dynamics365crm.client import Client
client = Client('RESOURCE', CLIENT_ID', 'CLIENT_SECRET')
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')
- see the documentation https://docs.microsoft.com/es-es/dynamics365/customer-engagement/web-api/contact?view=dynamics-ce-odata-9
can receive 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")
- see the documentation https://docs.microsoft.com/es-es/dynamics365/customer-engagement/web-api/account?view=dynamics-ce-odata-9
can receive 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")
- see the documentation https://docs.microsoft.com/es-es/dynamics365/customer-engagement/web-api/opportunity?view=dynamics-ce-odata-9
can receive 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")
- see the documentation https://docs.microsoft.com/es-es/dynamics365/customer-engagement/web-api/lead?view=dynamics-ce-odata-9
can receive 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")
- see the documentation https://docs.microsoft.com/es-es/dynamics365/customer-engagement/web-api/campaign?view=dynamics-ce-odata-9
can receive 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")
- requests
dynamics365crm/test.py
We are always grateful for any kind of contribution including but not limited to bug reports, code enhancements, bug fixes, and even functionality suggestions.
You can report any bug you find or suggest new functionality with a new issue.
- Fork it ( https://github.com/GearPlug/dynamics365crm-python )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Adds my new feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request