Bavya Rajendran
Bavya Rajendran

Reputation: 17

How will get the count using RestAPI with filter query

I will not get all the item on one time so i can't use .length of.

So I tried this rest API to get over all count.

/_api/web/lists/getbytitle('FAQ')/itemcount

It is working fine but with this api I can't pass any filter condition like isdisplay eq 1, so I moved to webservice "_vti_bin" call of

/_vti_bin/ListData.svc/FAQ/$count?$filter=IsDisplay eq true

But it is showing "Request Error" page in the browser. What am I doing wrong?

Upvotes: 0

Views: 5312

Answers (1)

Lee
Lee

Reputation: 5493

My test result:

enter image description here

/_vti_bin/listdata.svc/MyList/$count?$filter=IsDisplay%20eq%20true

enter image description here

Or you could get data.d.results.length by rest api with filter

/_api/web/lists/getbytitle('MyList')/items?$select=Title,Id&$filter=IsDisplay%20eq%201

Upvotes: 1

Related Questions