Reputation: 75
I have a SharePoint site and when I call
SITE/_api/web/lists/
it gives me the data for all the lists no problem. The problem is once I start querying for a specific list (for example one called "Environments") by calling
SITE/_api/web/lists/getbytitle("Environments")/
it gives me the error
Microsoft.SharePoint.Client.InvalidClientQueryExceptionThe expression "web/lists/getbytitle(Environments)/items" is not valid.
Am I not building the URL right or is there something wrong with the site.
Upvotes: 3
Views: 14418
Reputation: 7059
Use apostrophes ('
) instead of quotation marks around the title of your list.
If your list tile has apostrophes in its title, you need to escape those by replacing each apostrophe with %27%27
.
Upvotes: 5
Reputation: 447
Correct REST URL to get list items is :
http://site url/_api/web/lists/GetByTitle('Test')/items
You are missing single quotes around List name.
Check MSDN : https://msdn.microsoft.com/en-us/library/office/dn292552.aspx
Upvotes: 2