For past few days I have been working on a project which makes use of SharePoint REST API for filtering data from lists. I will like to share my findings here.
Let's create a custom list named "Company" as shown:
Now Go to List Settings- General Settings- Title description and navigation and change the name of the list from Company to Company Employees. Make sure to have space between Company and Employees.
Now, the name of the List is Company Employees and the url of the list contains Company only as can be seen:
Before, I show the actual REST queries let us add a text based column named "Employee Address" to the list.
The list with some sample data looks like this:
Now, almost all the examples I found showed the following way of making queries:
So my first attempt was to use the name of the list which is Company Employees and to my surprise I got the 404 error.
Then I tried "Company" as the url contained Company only and got the same error. After that I found the GUID of the list and tried that, and again got the same error. I was losing patience and searched everywhere and could not get any useful information. Finally, I removed the space between Company and Employees and tried again and viola I got the results.
Similarly, if we try to filter using "Employee Address" column, it turns out that neither display name of the field that is "Employee Address" nor its internal name i.e. "Employee_x0020_Address" work. It is actually the display name minus spaces which works i.e. "EmployeeAddress" as shown: