-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP GET API Filter wonkiness #7167
Comments
Hey @Windyo Sorry to hear you're having trouble. Would you mind swinging by our slack channel? We can provide better support there for this 😄 If it is actually a bug with Ghost we can reopen this. |
Hi @kirrg001, I thoroughly read #5604 before posting, but thank you for the link. When I say the returned post have no relation to the queried list, I mean the command list in the "Technical Details" section actually returns a list of posts which included posts in status published by author id 1, which has no relation to the query made, even considering a Same problem with the query listed in subsection "steps to reproduce", item 3. Concerning the URLEncode, I modified the request to the following:
but I still get the same It's also worth noting that injecting the request using Firefox "edit and send" from the request does not return a validation error with "+", but instead returns a list of posts which do not respect the filters given. I am frequently on your Slack channel, send me a line when you're online :) Have a nice week-end, |
Hey @Windyo, the lexer & parser behind filters are one of the main reasons why the Public API are still in beta 😉 The error you're getting is:
In this case the error is in the wrong place, but it's because you have an Also please note the |
Hey @ErisDS ! Yeah I figured that what I was doing was unsupported at the moment, but I thought that documenting the pitholes I found in the process could be useful. I edited the query after your comment and the validation error disappeared :) However passing the filters as data (urlencoded or not) fails in cURL, which means the working query is
for anyone looking to do the same thing. The data-url-encoded failing part is probably on the cURL side of things. On another note, the server responds positively with a full list of posts if the query is malformed, which is why I thought it threw a random list of posts. And thanks! :) |
Issue Summary
Making requests containing filters to the API endpoints via HTTP GET sometimes return strange things.
Steps to Reproduce
$BlogAdress/ghost/api/v0.1/posts/?filter=(status:draft)
returns the expected list of drafts.
$BlogAdress/ghost/api/v0.1/posts/?filter=(author_id=2)
returns the expected list of posts by an author.
$BlogAdress/ghost/api/v0.1/posts/?filter=(status:draft,author_id=2)
returns a seemingly random list of posts.
Additional information
+
operator between filters returns a validation error :expected AND, RPAREN, RBRACKET, got PROP
.Injecting the request using Firefox "edit and send" from the request does not return a validation error with "+", but instead returns a list of posts which do not respect the filters given.
$BlogAdress/ghost/api/v0.1/posts/?limit=all&filter=(status:draft,author_id=2
) where the list of returned posts do not resepect the filters.Technical details:
For the sake of completeness, the full request emitted :
curl --header "Authorization: Bearer $BearerToken" $BlogAdress/ghost/api/v0.1/posts/?filter=\(status:draft,author_id=2\)
The text was updated successfully, but these errors were encountered: