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

API /messages/message returns 500 if _expansions != array and doc is outdated #2932

Closed
gsommavilla opened this issue Apr 18, 2024 · 0 comments · Fixed by #2933
Closed

API /messages/message returns 500 if _expansions != array and doc is outdated #2932

gsommavilla opened this issue Apr 18, 2024 · 0 comments · Fixed by #2933
Labels

Comments

@gsommavilla
Copy link

gsommavilla commented Apr 18, 2024

Hi, I migrated from 2.1.4 to 3.3.2.

Before migration I checked API doc and changelog and saw that API ruotes and behaviour didn't change.

However, after migration, when testing api/v1/messages/message I realized that the _expansions parameter is not allowed anymore to be a boolean, but only a list of strings with message fields.

My application used the API with "_expansion":true and received a 500 Internal error (while it was working ok in 2.1.4).

If support for expansions as boolean is actually dropped, I suggest to

  1. add a control in app/controllers/legacy_api/messages_controller.rb to check if expansions is actually a list of strings and, it that's the case, return an informative 400 Bad Request/malformed request syntax or something like that (instead of the 500 disorienting message)

  2. update the API doc https://apiv1.postalserver.io/controllers/messages/message.html removing the following sentence about _expansions parameter: "You can send true rather than array to receive all expansions."

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants