Forum Discussion
Benjamin Haynes
Sep 27, 2016Copper Contributor
REST to filter on a FieldUrlValue
Hello I am trying to filter a list based on the Url value in a SP.FieldUrlValue using REST. I tried to use the expand odata command but this did not work. If I select the field in the REST call i...
Daniel Westerdale
Sep 27, 2016Iron Contributor
Hi
A couple of weeks ago I was doing similar things with a SPD site workflow for my client. I understand how fustrating the syntax is . Make sure your response evelope is json with a request header
accept=application/json;odata=verbose
You need to wrap brackets around your filter clause. -
https://thesiteiamtestingagainst/sites/test/_api/web/lists/getbytitle('Comments')/items?$filter=(URL eq 'http://www.bbc.co.uk')https://thesiteiamtestingagainst/sites/test/_api/web/lists/getbytitle('Comments')/items?slect=URL&$filter=(URL eq 'http://www.bbc.co.uk')
I think you need to get data out of your response evelope with a path similar to
d/results
Thereafter you can pick the values with the desired path - you will need to confirm this a tool like Postman.
Good luck
Benjamin Haynes
Sep 28, 2016Copper Contributor
Thank you for your reply Daniel
Unfortunately this returns the following when I tried it.
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <m:code>-1, Microsoft.SharePoint.SPException</m:code> <m:message xml:lang="en-US"> The field 'URL' of type 'URL' cannot be used in the query filter expression. </m:message> </m:error>
Maybe you cannot filter on the URL column type via REST?