Skip to content

Inconsistency between how fields can be specified for GET and form-data POST requests #1089

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

Closed
theosanderson opened this issue Feb 27, 2025 · 3 comments · Fixed by #1128, #1131 or loculus-project/loculus#4094
Assignees

Comments

@theosanderson
Copy link

For GET requests you can make a request:

https://lapis-main.loculus.org/cchf/sample/details?fields=accession,accessionVersion

However the corresponding POST request, which is what the Swagger UI generates, doesn't work:

curl -X 'POST' \
  'https://lapis-main.loculus.org/cchf/sample/details' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'fields=accession,accessionVersion'`

But one can work around this with:

curl -X 'POST' \
  'https://lapis-main.loculus.org/cchf/sample/details' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'fields=accession&fields=accessionVersion'
@fengelniederhammer
Copy link
Contributor

We discussed it: Actually the current behavior looks ok from our perspective. fields=accession&fields=accessionVersion is the usual way how one would specify an "array" in URLs and forms. Maybe we included the fields=accession,accessionVersion version for backwards compatibility.

What remains to be done: clarify in the docs what works.

@theosanderson
Copy link
Author

And I guess there's also a remaining (but maybe impossible) issue that Swagger generates this format

Image

@fengelniederhammer
Copy link
Contributor

Swagger generates this format

That is indeed unfortunate. But I guess we can't do much about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment