0

My Sails.js application has a model called 'Ideas' and using the default blueprint REST api, I can access the contents of the collection when I go to: http://example.com/ideas/find

Furthermore, by default, I can also limit the data to get specific titles: http://example.com/ideas/find?title=How to Watch TV

Although what I want to do is display the JSON data of ALL titles that contain the keyword 'T' but when I replace the above with the likes of

a) ?title=TV
b) ?q=TV
c) ?query=TV
d) ?where(title : (contains:'TV')

none of them work

How can I get JSON output that contains all titles that contains a particular keyword?

user3721307
  • 199
  • 2
  • 12

2 Answers2

4

Based on the documentation, the where example should work. It uses curly brackets instead of parenthesis though.

?where={"title":{"contains":"TV"}}

Timothy Strimple
  • 22,920
  • 6
  • 69
  • 76
  • actually one more question :-) what would the query be if I want the title to contain TV & Music - I tried the following but they did not do it: a) ideas/find?where={"title":{"contains":"music"}}&{"title":{"contains":"film"}} – user3721307 Dec 12 '14 at 22:13
0

For multiple use ",".

Example :

ideas/find?where={"title":{"contains":"music"}},{"title":{"contains":"film"}}
John Slegers
  • 45,213
  • 22
  • 199
  • 169
splifo
  • 45
  • 5