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

return 404 not found response for unknown studies and samples #1058

Closed
dwinston opened this issue Sep 22, 2023 · 3 comments
Closed

return 404 not found response for unknown studies and samples #1058

dwinston opened this issue Sep 22, 2023 · 3 comments
Assignees

Comments

@dwinston
Copy link

examples:

related to implementation of microbiomedata/issues#423

@jeffbaumes
Copy link
Collaborator

The API call to retrieve the object does return a 404 in these cases (you can see that in the inspector), but we should indeed show some indication that the study/sample is not found, it currently just silently fails to initialize the view. Instead of 404-ing the entire page, I believe the right thing is to display something like "Sample not found." in the main app content area.

@dwinston
Copy link
Author

Instead of 404-ing the entire page, I believe the right thing is to display something like "Sample not found." in the main app content area.

I'd like for us to do both, as these behaviors are not mutually exclusive. The status code and response body are separate concerns for an HTTP response. I agree with returning a human-readable HTML response ("sample not found"), but I would like GET https://data.microbiomedata.org/details/study/nmdc:sty-NotARealID (and not only GET https://data.microbiomedata.org/api/study/nmdc:sty-NotARealID) to return a 404 status code.

In the meantime, I will use GET /api/study/nmdc:{localpart} and GET /api/biosample/nmdc:{localpart} to determine whether the data portal knows about a study or biosample, respectively.

@naglepuff
Copy link
Collaborator

The first URL listed (/details/study/nmdc:sty-NotARealID) belongs to the Vue application router, so it should only be accessed from the Vue client.

The second URL is the preferred method of getting information out of the Data Portal's postgres database, and corresponds to an endpoint in our FastAPI backend. That one will throw the 404 you'd expect

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

No branches or pull requests

3 participants