Step 1:- Generate bearer token
Note:-For every one hour generate new bearer token to avoid authorization error.
Get :-https://login.microsoftonline.com/tenantid/oauth2/token
Body:- formdata
a) tenant_id –
b) client_id –
c) client_secret –
d) grant_type – client_credentials
e) resource – enter D365FO environment URL (note it should not end with /)
Output:-
{
"token_type": "Bearer",
"expires_in": "3599",
"ext_expires_in": "3599",
"expires_on": "1723463000",
"not_before": "1723459100",
"resource": "https://trial-zpgyvk.trial.operations.dynamics.com/",
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IktRMnRBY3JFN2xCYVZWR0JtYzVGb2JnZEpvNCIsImtpZCI6IktRMnRBY3JFN2xCYVZWR0JtYzVGb2JnZEpvNCJ9.eyJhdWQiOiJodHRwczovL3RyaWFsLXpwZ3l2ay50cmlhbC5vcGVyYXRpb25zLmR5bmFtaWNzLmNvbS8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9jYTA2YTExMC1mYzMwLTQ3ZTUtOWRkNC03MThkNWQ0YzQyNDQvIiwiaWF0IjoxNzIzNDU5MTAwLCJuYmYiOjE3MjM0NTkxMDAsImV4cCI6MTcyMzQ2MzAwMCwiYWlvIjoiRTJkZ1lEaW5WelN6T2o1LzZaSHN2Y212UHA0eEFnQT0iLCJhcHBpZCI6IjQ5ZjAxNWI5LWQ1MzMtNDdlNi1iYTI2LTc3MGZlMTU3Y2NjMyIsImFwcGlkYWNyIjoiMSIsImlkcCI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0L2NhMDZhMTEwLWZjMzAtNDdlNS05ZGQ0LTcxOGQ1ZDRjNDI0NC8iLCJpZHR5cCI6ImFwcCIsIm9pZCI6IjYyNGE1MDBiLTk3ODItNDk1ZC1hMWQ1LTc4YTNkYTg2MTg2OSIsInJoIjoiMC5BU29BRUtFR3lqRDg1VWVkMUhHTlhVeENSQlVBQUFBQUFBQUF3QUFBQUFBQUFBQXFBQUEuIiwic3ViIjoiNjI0YTUwMGItOTc4Mi00OTVkLWExZDUtNzhhM2RhODYxODY5IiwidGlkIjoiY2EwNmExMTAtZmMzMC00N2U1LTlkZDQtNzE4ZDVkNGM0MjQ0IiwidXRpIjoiZXdQWWU3S2hoVXllS0dURGgtS1VBQSIsInZlciI6IjEuMCIsInhtc19pZHJlbCI6IjcgMiJ9.kNDAndZRZgwN-78gPl3aSHW-A7am5hSALHrqDJpwJBITgXePf2BtbqkyMYV6H_T_vlCp2nCymEFrSbJJFihGQ1f5xiuth9vjLasSm1sH5mK2Gr8t7Y78YEdjYnABI0NIIrHBug__aEGdB-eAd7zBmI_rZ9f1ca4UBHxlrjskZCB6hoEjO44v0_eisWTwU5o6no6GI8ZrpAbDiNkqpiZMwwfh6JJfm9SQwq1k_rTFhyGQ8lg19zofxy4l29IMw4-kwTqQYN5_JeEiZCxVbsJ2WjUJpLzKNpabyDe859Vr9HQe1MwSAZHfgvvPF3020po9hrhznewHkOGmKKOGZyzrNQ"
}
Step 2:- To get data use method GET
Eg:-Output as below
{
"@odata.etag": "W/\"JzAsMjI1NjU0MjExODMn\"",
"dataAreaId": "demf",
"CustomerGroupId": "20",
"ClearingPeriodPaymentTermName": "Net30",
"DefaultDimensionDisplayValue": "",
"CustomerAccountNumberSequence": "",
"AccountingCurrencyExchangeRateType": "",
"IsSalesTaxIncludedInPrice": "No",
"Description": "Major customers",
"WriteOffReason": "",
"ReportingCurrencyExchangeRateType": "",
"PaymentTermId": "Net30",
"TaxGroupId": "",
"IsPublicSector_IT": "No"
}
Step 3:-To insert new record
Post:-https://trial-zpgyvk.trial.operations.dynamics.com/data/CustomerGroups?cross-Company=true
Body:-Previous get method output
{
"dataAreaId": "demf",
"CustomerGroupId": "111",
"ClearingPeriodPaymentTermName": "Net30",
"DefaultDimensionDisplayValue": "",
"CustomerAccountNumberSequence": "",
"AccountingCurrencyExchangeRateType": "",
"IsSalesTaxIncludedInPrice": "No",
"Description": "Major customers",
"WriteOffReason": "",
"ReportingCurrencyExchangeRateType": "",
"PaymentTermId": "Net30",
"TaxGroupId": "",
"IsPublicSector_IT": "No"
}
Output:-
Step 4:-To update a record
Patch:-https://trial-zpgyvk.trial.operations.dynamics.com/data/CustomerGroups(dataAreaId='usmf',CustomerGroupId='111')?cross-company=true
Body:-
{
"dataAreaId": "usmf",
"CustomerGroupId": "111",
"AccountingCurrencyExchangeRateType": "",
"IsSalesTaxIncludedInPrice": "No",
"Description": "manikanta",
"WriteOffReason": "",
"ReportingCurrencyExchangeRateType": "",
"PaymentTermId": "Net30",
"TaxGroupId": "",
"IsPublicSector_IT": "No"
}
Output:-
Step 5:-Put method is also used to update but whatever fields which we are updating will updated and rest will considerd as null values
Put:-https://trial-zpgyvk.trial.operations.dynamics.com/data/CustomerGroups(dataAreaId='usmf',CustomerGroupId='111')?cross-company=true
Body
{
"dataAreaId": "usmf",
"CustomerGroupId": "111",
"PaymentTermId": "Net30",
}
Output:-
Step 6:-To delete a record
Delete:-https://trial-zpgyvk.trial.operations.dynamics.com/data/CustomerGroups(dataAreaId='usmf',CustomerGroupId='111')?cross-company=true
Body:- no body required
Output:-
No comments:
Post a Comment