I have a module where am trying to get data from a SharePoint list and display it in a SharePoint page. First, I am showing the first 10 items without doing any filtering like this, where my REST query looks like this:

   var newsQuery = _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getByTitle('News')/items?$orderby= PublishDate desc&$top=10";

After that, when the news is displayed to the user, he can choose the country for that neww from a dropdown, then the type of the news from 1 of few checkboxes, so when filtering based on the country the news query would, I wrote code that will generate a query that looks like this:

"http://website.com/_api/web/lists/getByTitle('News')/items?$orderby= PublishDate desc&$top=10&$filter=(Country eq 'USA')"

The initial query works fine on production AND staging, also filtering the news by country works on both environments. I am having a problem when filtering based on one of the checkboxes. The code I wrote generates this query:

"http://website.com/_api/web/lists/getByTitle('News')/items?$orderby= PublishDate desc&$top=10&$filter=(Country eq 'USA') and (Sports gt 0)"

In my case, a news can have multiple categories, so a user can choose more than 1 checkbox for a country, in my SharePoint list, there are single line of text fields, representing the news categories, with description for each one filled in that category, so I want to get the ones that have Sports filled.

The query works in development environment, and on staging.

It works on production for few categories, sports, finances,etc.. but not for a few other categories.

Did anyone face such issues with REST? maybe with HTTPS? as it's an internet site.

So basically:

Getting ALL items works on dev/staging/prod

Filtering for countries works on dev/staging/prod

Filtering on categories (single line of text in the list) works for few columns in prod, but works for all columns in dev/staging.

  • Are you 100% sure the column internal names are the correct ones in production?
    – Evariste
    Jan 8, 2017 at 6:54
  • Thanks @Evariste, Yes, they're are 100% correct. I am also using the internal names in my code to bind the returned results, so without filtering I can see the values binded and the results for categories. But when filtered, nothing is returned for specific categories.. Jan 8, 2017 at 6:56
  • OK... and are you 100% sure about the values? No space before or after in the text fields? No special characters in them?
    – Evariste
    Jan 8, 2017 at 7:00
  • Hi Evariste, some of the fieldds have special characters as their values, yes Jan 8, 2017 at 14:52
  • And did you find a correlation between values with with special characters and failing values?
    – Evariste
    Jan 8, 2017 at 15:00

2 Answers 2


I'd start with double checking your items are there and have the correct metadata
WITH the account the public website uses

If that account can't find any items manually then REST can never return them either.

Most often these are publishing related issues. Is everything checked in and published?

  • Thank you Danny, there are no publishing processing going on. Anonymous users can use the REST call to get all news. They can use the REST call to get news filtered by country AND some categories. They however are not able to filter based on other categories. So some single line of text fields are working with the filters, others are not. But in other environments everything is working. Jan 8, 2017 at 14:49

It turns out that REST filters for null won't work on single line of text fields that start with special characters, it filters on fields that don't starrt special characters.

In production, the data entry team entered values like this: /subweb/pages/news1.aspx , REST won't see this item at all if you will filter on the column that contains this value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.