Showing posts with label odata. Show all posts
Showing posts with label odata. Show all posts

Friday, 25 December 2015

REST End point URLs - SharePoint 2013

Today I will be sharing the Service End point URLs for the SharePoint 2013. To access SharePoint resources using REST, construct a RESTful HTTP request, using the Open Data Protocol (OData) standard, which corresponds to the desired client object model.

Example :

List Name - Products

Columns - Title , Company , Products , Manager

In which Title , Company are Single Line of Text columns.
Company is a lookup column ( LookUp list - Company Names  and It is Looking up to the column Company name with Internal Name Title ) .
Manager is a people Picker Column.

Service call for accesssing the columns would be -

(Always use Internal names for the columns and Display names for the List)
https://halyardhealth.sharepoint.com/sites/SPDEV/_api/web/lists/getbytitle('Products')/items?$select=Title,Products,Company/Title,Manager/Title&$expand=Company,Manager

For Lookup and People picker colums we have to expand the column like above

For applying the filter on the above query -

https://halyardhealth.sharepoint.com/sites/SPDEV/_api/web/lists/getbytitle('Products')/items?$select=Title,Products,Company/Title,Manager/Title&$expand=Company,Manager&$filter=Products eq 'Product 1'

https://halyardhealth.sharepoint.com/sites/SPDEV/_api/web/lists/getbytitle('Products')/items?$select=Title,Products,Company/Title,Manager/Title&$expand=Company,Manager&$filter=Company/Title eq 'Company 1'

For applying multiple filters :

https://halyardhealth.sharepoint.com/sites/SPDEV/_api/web/lists/getbytitle('Products')/items?$select=Title,Products,Company/Title,Manager/Title&$expand=Company,Manager&$filter=((Products eq 'Product 1') and(Company/Title eq 'Company 1'))

From the next post onwards I will be providing the codes for CRUD operation on Sharepoint 2013 list using Rest api.

Happy Coding...

Sunday, 15 March 2015

Odata querying 100 items only issue - SharePoint

Hi Coders,
 This post will be useful for the beginners, who has already started using Odata in SharePoint 2013. You might have faced this issue or you havent figured it out yet.

For Odata queries please refer this.

So based on the above link, for retrieving items from the list , we have to use the following syntax.
http://server/site/_api/web/lists('guid')/items?$select=Title
This provides you the "Title" column value of  the items in the list.

So, the tweak in this query is, by default it returns only 100 items..
This important point has been missed in most of the documentation..


FIX : 
So to fix this we have to use the "top" clause.
http://server/site/_api/web/lists('guid')/items?$select=Title$top=10000

We have to give a maximum value based on our application nature.

Hope this helps..

Have a good day. Meet you on the next post.
Happy Sharepointing......