Using Python to fetch data from D365 Finance & operations
Step 3. We are going to use Jupyter Notebook here, for our code. This could be easily launched, if you have installed Anaconda as your IDE and then simply going to Windows \\ Jupyter. This will prompt you with an intermittent DOS prompt like this:
And will eventually open the Jupyter browser which looks lot like this:
Step 4: We are going to use the following modules for our code:
import requests
import json
The former handles the requests and responses from API calls while the latter contains Newtonsoft based various intefcaes and class for decoding.
Step 5: Define your app registration details under various variables:
CLIENT_SECRET = ' ##Your client secret here##'
TENANT_ID = '##Your tenant here##'
tokenendpoint = 'https://login.microsoftonline.com/<Give your tenant Id>/oauth2/token'
CLIENT_ID = '##Your client ID##'
GRANT_TYPE = 'Client_credentials'
RESOURCE = '<D365fO base URL>/.default'
BaseURL = '<D365fO base URL>/.'
Step 7:
Get the token and store it in a variable:
tokenres = requests.get(tokenendpoint, data=tokenpost)
In our previous discussion (https://subsd365.blogspot.com/2024/03/an-example-of-predictive-modelling.html) we saw how can we create a sampling based predicitve modeling strucure, where we can train our machine learning model with data and can find how easily it can predict any answer to a question. In the example we used, we were training the data with viewers, their genders, age and their fascination for movie-genres. So we asked the program what could be a man of age 40 would prefer to watch. And our code very smartly replied: Family drama.
Likewise, we can use the data from D365FO to train our models to predict various outcomes and statistical manipulations.
Comments
Post a Comment