REST based access to CRM 2011

Dynamics CRM 2011 supports a rich REST based endpoint allowing Javascript, Silverlight and other resources to access your CRM data.  The latest CRM 2011 SDK contains some (beta) details on the request and response structures needed to perform the CRUD operations.

These CRM 2011 web services also support the OData Protocol and $select, $filter, $orderby and $top can be applied to a query string request to return ATOM formatted data to your client application.  For example, operations against the Contact recordset cover

$Select

Select specific columns from the ContactSet using

https://.../organizationdata.svc/ContactSet?$select=FullName,Address1_Country

or select the Contact Fullname and the Parent Customer record

https://.../organizationdata.svc/ContactSet?$select=FullName,ParentCustomerId

In the resultset, the Parent Customer ID is resolved to a record id (GUID) and, by default, includes the Primary Field of the related record (as we would expect with CRM)

$orderby

The sort order can be specified with the $orderby clause, for example

https://.../organizationdata.svc/ContactSet?$select=FullName,Address1_Country&$orderby=FullName desc

$top

You can also limit the number of records returned using the $top clause, for example the first 5 records ordered by descending FullName is

https://.../organizationdata.svc/ContactSet?$select=FullName,Address1_Country&$orderby=FullName desc&$top=5

$Filter

Search for all the Contacts in the country of Ireland is possible with

https://.../organizationdata.svc/ContactSet?$filter=Address1_Country%20eq%20'Ireland'

More details on the CRUD operations are available in the CRM 2011 SDK that can be downloaded from here.