Skip to content
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

Filter queries not working #36

Closed
JDsnyke opened this issue Aug 12, 2020 · 4 comments
Closed

Filter queries not working #36

JDsnyke opened this issue Aug 12, 2020 · 4 comments

Comments

@JDsnyke
Copy link
Contributor

JDsnyke commented Aug 12, 2020

Hi All,

I cant seem to get filter queries to work. I'm simply working with,

curl https://api.up.com.au/api/v1/transactions -G -H "Authorization: Bearer up:yeah:mypat" -d "filter[since]=2020-01-01T01:02:03+10:00"

And I keep getting,

{"errors":[{"status":"400","title":"Invalid Parameter","detail":"invalid date-time value (must be rfc-3339)","source":{"parameter":"filter[since]"}}]}

I've double checked the date time value and different variations (this is taken directly from the examples on the api site)! Is there something else I'm doing wrong? 😕

@d11wtq
Copy link
Contributor

d11wtq commented Aug 12, 2020

@JDsnyke It'll be the + symbol. That's not a URL safe character (actually neither are the : and the [] but curl is likely encoding those for you and they'd most likely be accepted either way). You need to URL encode that + as %2B otherwise the server sees that as a space character. This is something on our TODO list to explicitly call out the need for proper URL encoding even if the examples in the docs don't encode simply for readability. Correctly encoded that timestamp would be difficult to read.

@d11wtq
Copy link
Contributor

d11wtq commented Aug 12, 2020

I think what we'll do with the docs is we'll provide a readable (non-encoded) example alongside the parameter definition, we'll explicitly state that it's not URL encoded for readability, then we'll adjust the full curl example to include that type of filter but correctly encoded so it should be copy/paste-able. If we URL encoded everything in the docs I think it would likely be more confusing what you're supposed to pass and generally you won't manually URL encode things—whatever client library you use would take the raw value and URL encode it for you.

@JDsnyke
Copy link
Contributor Author

JDsnyke commented Aug 12, 2020

Ah, that explains it. Thanks @d11wtq!

@d11wtq
Copy link
Contributor

d11wtq commented Aug 13, 2020

Closing and replacing with #37

@d11wtq d11wtq closed this as completed Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants