Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 13977

CRM Web API Using Python

$
0
0
Another example using the new CRM Web API this time using Python.

Once again we have the luxury of using a version of Azure Active Directory Authentication Library (ADAL) but this time for Python. You can reference it using Python’s package manager (pip) with this info: https://pypi.python.org/pypi/adal/0.1.0

Again authenticating using a hardcoded username and password.
# CRM URL
RESOURCE_URI = 'https://org.crm.dynamics.com'
# O365 credentials for authentication w/o login prompt
USERNAME = 'administrator@org.onmicrosoft.com'
PASSWORD = 'password'
# Azure Directory OAUTH 2.0 AUTHORIZATION ENDPOINT
AUTHORIZATION_URL = 'https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000'

token_response = adal.acquire_token_with_username_password(
AUTHORIZATION_URL,
USERNAME,
PASSWORD,
resource=RESOURCE_URI
)

token = token_response['accessToken']

In this case we aren’t even sending a Client Id as part of the authentication request.  

Additional information about ADAL for Python:

https://github.com/AzureAD/azure-activedirectory-library-for-python

You can check out the code on GitHub:

https://github.com/jlattimer/CrmWebApiPython

Web API Examples:

Viewing all articles
Browse latest Browse all 13977

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>