Showing posts with label REST endpoints query in CRM 2011. Show all posts
Showing posts with label REST endpoints query in CRM 2011. Show all posts

Thursday, June 16, 2011

Tips for using REST endpoints in CRM 2011(Rest endpoints browser)

Using REST endpoints with json2 are the simplest way to retrieve data in CRM 2011. The code is clean and simple. Here is a sample retrieve request

retrieveAccountsReq.open("GET", getRESTUrl() +

"/new_postcodeSet?$top=20&$select=new_name,new_Country,new_Suburb,new_State,new_postcodeId&$filter=new_name
eq ('"
+ postcode + "')", true);


The above request is used to retrieve the custom entity (new_postcode) dataset where new_name is equal to postcode.

The result will look like this
image
To get the fieldnames for an entity you can use http://servername:portnumber/organization name/XRMServices/2011/OrganizationData.svc/entitySet

The result will look like this

image

You can even paste the query in the browser and check the result of the query. The following query will display all the records with postcode 2010.

http://tcrm2010:5555/CRM/XRMServices/2011/OrganizationData.svc/new_postcodeSet?$select=new_name,new_Country,new_Suburb,new_State,new_postcodeId&$filter=new_name

The result will look like this

image

Conclusion

REST endpoints are the best way to retrieve data on client site. You can even see the result of the query in the browser.

Happy Programming……..