0
[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">
<m:code>
-1, Microsoft.SharePoint.Client.InvalidClientQueryException
</m:code>
<m:message xml:lang="en-US">
The expression "web/lists/GetByTitle(‘ListName’)/items" is not valid.
</m:message>
</m:error>

(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?

3
  • 1
    encoding problem of your single quotes and missing a forward slash? [site name]/_api/web/lists/GetByTitle('ListName')/items Commented Oct 31, 2016 at 17:56
  • missing the slash '[site name]/_api/web/lists/GetByTitle(‘ListName’)/items' Commented Oct 31, 2016 at 17:57
  • Included more info on main question. Please consider and comment. Commented Nov 1, 2016 at 20:17

2 Answers 2

0

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
2
  • 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 ?! Commented Oct 31, 2016 at 19:37
  • Included more info on main question. Please consider and comment. Commented Nov 1, 2016 at 20:17
0

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?

1
  • I needed to complete the Request Header in full: Accept / Content-Type / content-length / X-RequestDigest. Post still not working though. Commented Nov 10, 2016 at 23:05

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.