In our earlier articles, we discussed how to write create, retrieve and retrievemultiple requests, today we are going to discuss about writing update request using Web API for Dynamics CRM 2016.
To update data, we have the following two http methods:
PATCH This method is used to update multiple property of particular entity type. To update multiple properties, we can create object and define properties that we want to update like below, let’s say we want to update account record:
After that we can pass it to record URI like the following,
PUT This method is used to update single property of particular entity type. We need to pass the property name with entity URI itself and in object we can pass value of the property like the following,
So the complete code will be like below:
And in case if we need to update single-valued navigation (lookup), we can do it like following:
And need to pass URI without property name like the following:
Stay tuned for more Web API Samples!