Trouble with filter operators in curl

Hi everyone, I’m new to Ghost, and I’m struggling with some filter operators via curl.

Simple filters like equation and negation work, but I can’t get operators like ~, ~^, or ~$ to work.

For example, these examples (based on the working example curl) work:

curl "https://demo.ghost.io/ghost/api/content/posts/?key=22444f78447824223cefc48062&include=authors&filter=slug:welcome"

and

curl "https://demo.ghost.io/ghost/api/content/posts/?key=22444f78447824223cefc48062&include=authors&filter=slug:-welcome"

But these return Request not understood error, cannot list posts:

using ~ for “contains”: curl "https://demo.ghost.io/ghost/api/content/posts/?key=22444f78447824223cefc48062&include=authors&filter=slug:~wel"

using ~^ for “starts with”: curl "https://demo.ghost.io/ghost/api/content/posts/?key=22444f78447824223cefc48062&include=authors&filter=slug:~^wel"

using ~$ for “ends with”: curl "https://demo.ghost.io/ghost/api/content/posts/?key=22444f78447824223cefc48062&include=authors&filter=slug:~$come"

(I’ve tried urlencoding each of these filters, but they still fail.)

Any idea what’s going on here? Can those operators only be used within a Ghost install, and not via curl?

When using multi-token operators, it looks like you need to wrap the value in single quotes: curl "https://demo.ghost.io/ghost/api/content/posts/?key=22444f78447824223cefc48062&include=authors&filter=slug:~'wel'"

1 Like

brilliant, thank you so much!

1 Like