Priya Biswal
Priya Biswal

Reputation: 35

How to get audit history data using web api in 2016 on premise CRM

I need to get the audit history details for specific record wise using web api only not though custom code.

I tried to get the audit history by using the below code. But it is not returning the required information as I need the old and value column wise. https://xxxxx/api/data/v8.2/audits?$filter=_objectid_value%20eq%20AFF6BF88-8A78-CDAE-8829-5B702E2F89D9

Then I tried the "RetrieveRecordChangeHistory" function. It is working in the custom c# code but not working in the web api.

https://xxxx/api/data/v8.2/RetrieveRecordChangeHistory(Target=@Target)?@Target={%22contactid%22:%22AFF6BF88-8A78-CDAE-8829-5B702E2F89D9%22,%[email protected]%22:%22Microsoft.Dynamics.CRM.contact%22}.

The above url giving the below error.

{ "error":{ "code":"","message":"Resource not found for the segment 'RetrieveRecordChangeHistory'.","innererror":{ "message":"Resource not found for the segment 'RetrieveRecordChangeHistory'.","type":"Microsoft.OData.Core.UriParser.ODataUnrecognizedPathException","stacktrace":" at Microsoft.OData.Core.UriParser.Parsers.ODataPathParser.CreateFirstSegment(String segmentText)\r\n at Microsoft.OData.Core.UriParser.Parsers.ODataPathParser.ParsePath(ICollection1 segments)\r\n at Microsoft.OData.Core.UriParser.Parsers.ODataPathFactory.BindPath(ICollection1 segments, ODataUriParserConfiguration configuration)\r\n at Microsoft.OData.Core.UriParser.ODataUriParser.Initialize()\r\n at System.Web.OData.Routing.DefaultODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath, ODataUriResolverSetttings resolverSettings, Boolean enableUriTemplateParsing)\r\n at System.Web.OData.Routing.DefaultODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath)\r\n at Microsoft.Crm.Extensibility.OData.CrmODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath)" } } }

Upvotes: 0

Views: 1978

Answers (1)

The RetrieveRecordChangeHistory function was not available from web api in CRM 2016 (v8.2) and it was added in web api function list later, which is v9

v8.2 functions list

v9 functions list

Upvotes: 1

Related Questions