[site name]_api/web/lists/GetByTitle(‘ListName’)/items

So why does this not work? All the examples I see indicate that it should work.

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
-1, Microsoft.SharePoint.Client.InvalidClientQueryException
<m:message xml:lang="en-US">
The expression "web/lists/GetByTitle(‘ListName’)/items" is not valid.

(20161101) More info:

I’m working through this example: [https://blogs.msdn.microsoft.com/sridhara/2014/08/21/fix-sharepoint-2013-workflow-recursion-prevention-part-2/]

List 2 successfully creates a new item, and I can get the GUID from that new item. This next step fails.

HTTP Web Service info: [%WorkflowContext:CurrentSiteURL%]_api/web/lists/GetByTitle('List2')/items?$filter=GUID eq '[%Variable: NewItemGUID%]'

Response Code = BadRequest. I also log the http web service call string:

https://testwebsite/_api/web/lists/GetByTitle(‘List2’)/items?$filter=GUID eq '38bc1c7d-e020-4c71-a8bf-5b1a344e6b1d'

What's wrong with the above?

  • 1
    encoding problem of your single quotes and missing a forward slash? [site name]/_api/web/lists/GetByTitle('ListName')/items – Eric Alexander Oct 31 '16 at 17:56
  • missing the slash '[site name]/_api/web/lists/GetByTitle(‘ListName’)/items' – Gautam Sheth Oct 31 '16 at 17:57
  • Included more info on main question. Please consider and comment. – MaxK-2773298 Nov 1 '16 at 20:17

It looks like you might have copied the URL from a site. You have two issues with the URL:

[site name]_api/web/lists/GetByTitle(‘ListName’)/items

First, you need a / between [site name] and _api

Second, the quotes you are using are special characters, not real quotes. ‘ListName’ is not the same as 'ListName'.

So your full URL would be:

[site name]/_api/web/lists/GetByTitle('ListName')/items
| improve this answer | |
  • Thanks for the information. Quotes = I guess my pasting it into here changed the quotes. I’m using the correct ‘. [site name] missing /, I’m playing with HTTP web service and the variable for Current Site URL already has the / in it. Note - the query started to work ?! – MaxK-2773298 Oct 31 '16 at 19:37
  • Included more info on main question. Please consider and comment. – MaxK-2773298 Nov 1 '16 at 20:17

Found a good resource that helped me out. http://codelesssharepointinfopath.com/tag/start-workflow/

Using the ‘call http web service’ I was able to get the guid of the workflow and the ID of the list item. Everything worked up to the last POST where the workflow is triggered.

[web site]_api/SP.WorkflowServices.WorkflowInstanceService.Current/StartWorkflowOnListItemBySubscriptionId(subscriptionId='[guid of workflow]'),itemId='[id of list item]'

The http response code is OK, but nothing is happening. Any thoughts?

| improve this answer | |
  • I needed to complete the Request Header in full: Accept / Content-Type / content-length / X-RequestDigest. Post still not working though. – MaxK-2773298 Nov 10 '16 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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