dynamics-crm Using Web API with jQuery Getting accounts


Example

This sample fetches accounts using a jQuery ajax method. On thing to note is that you need to set the header in the call to make the work.

$.ajax({
    url: Xrm.Page.context.getClientUrl() + '/api/data/v8.0/accounts',
    headers: { 
        'Accept': 'Application/json' 
    }
}).done(function (result) {
    var accounts = result.value;
});