Home / GitHub Page

API searching / filtering

Hi,
I tried to do 2 things:

first try

using the endpoint https://joplinapp.org/api/#searching

but failed because /SEARCH endpoint required token, that I already provided

example w/o token

curl -XGET http://localhost:41184/search?query="todo_due:0"
{"error":"Missing \"token\" parameter"}

and w/

curl -XGET http://localhost:41184/search?query="todo_due:0"\&token=fff6170db0bbb65bf9e37211a056dcc8f7cf6239e8745a90bd62da0ff328fcc6e8162552139e382301520ca8
{"error":"Invalid \"token\" parameter"}

is that a bug ?

2nd try

I try to get only notes with todo_due > 0 but am unable to do it

curl -XGET http://localhost:41184/search?query="todo_due\>0"\&token=fff6170db0bbb65bf9e37211a056dcc8f7cf6239e8745a90bd62da0ff328fcc6e8162552139e382301520ca8
{"error":"Invalid \"token\" parameter"}

is my query false ?

Did you exactly cut/paste the token from Joplin’s Clipper info page?

I’ll need to check but at first sight there’s something wrong with your url because there’s a backslash before the &

Also the search syntax is the same as what you’d type in the app search box so your example queries wouldn’t work.

We have to escape & otherwise Linux will send curl in background.

@sciurius I’ll check

In some shells, you also need to escape the ? . But forgetting to do so yields a shell error (no match or something similar).

I tried the search on my joplin, and it went ok (i.e… it delivered [] since no matches). When I added a typo to the token I got the exact message that OP got.

What I usually do is put the URL in single quotes, that way there’s no need to escape.

The search end point works for me so I think the token in your request really is not valid, maybe some wrong copy and paste.

I’ll see that. Thanks

i did try

curl -XGET 'http://127.0.0.1:41184/search?query="title:Joplin Web todo liste"&token=xxx'

or

curl -XGET 'http://127.0.0.1:41184/search?query=title:"Joplin Web todo liste"&token=xxx'

and get not error,… but got no result too.

So I tried in the desktop version in the search field i entered

title:“Joplin Web todo liste”

and got no result .
I have one result when I just do “Joplin Web todo liste”
then I tried

curl -XGET 'http://127.0.0.1:41184/search?query="Joplin Web todo liste"&token=xxx'

and got no result :confused:

I can have result with desktop or terminal version with

title:joplin

or

curl -XGET 'http://127.0.0.1:41184/search?query=title:joplin&token=xxx'

it looks like query=title:"some words" and query="some words" do not work in both case

You do not need the additional quotes but must URL-encode the query. E.g.

curl -XGET 'http://127.0.0.1:41184/search?query=Joplin+Web+todo+liste&token=xxx'
1 Like

thank you it’s ok :slight_smile:

empty result

So after all of that tries with “title:xxx”, remains the idea to check todo_due > 0 that returns []

curl -XGET 'http://127.0.0.1:41184/search?query=todo_due>0&token=the_token&field=title,todo_due'
[]

“field” parameter

Also when using field the return result does not only display those fields

curl -XGET 'http://127.0.0.1:41184/search?query=is_todo:1&token=the_token&field=id,todo_due'

but every fields

[
{"id":"5c4cd72cdb4e43a582eed7e4d752439c","title":"Useful Vue patterns, techniques, tips and tricks and helpful curated links.","is_todo":0,"todo_completed":0,"parent_id":"2ed9f8a4a5f5469eb78b16b541484d34","updated_time":1531648956048,"user_updated_time":1531648956048,"user_created_time":1531648956048,"encryption_applied":0,"type_":1},{"id":"c8c4b3f4c90046469cec6c442fd33a2e","title":"Getting Started with Vuex ― Scotch","is_todo":0,"todo_completed":0,"parent_id":"2ed9f8a4a5f5469eb78b16b541484d34","updated_time":1534076810352,"user_updated_time":1534076810352,"user_created_time":1534076810352,"encryption_applied":0,"type_":1},
{"id":"fe31b0d783744d6085ce17e1d0a73805","title":"Modélisation d'un arbre avec Django et PostgreSQL (FR)","is_todo":0,"todo_completed":0,"parent_id":"ee7c298fab154d5387c347610d06567d","updated_time":1557081664317,"user_updated_time":1557081664317,"user_created_time":1543353419107,"encryption_applied":0,"type_":1}
]

And the value of is_todo I searched was 1 not 0 as the result show

may I have again forgotten something.

Just to be clear, only what it’s in the documentation, and nothing more, works. So there’s no “todo_due>0”, no “is_todo:1” etc. You’ll need to do manual filtering if you need this information.