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

Unable to retrieve single Activity records via the REST API #1060

Closed
codycooperross opened this issue Dec 8, 2023 · 4 comments
Closed

Unable to retrieve single Activity records via the REST API #1060

codycooperross opened this issue Dec 8, 2023 · 4 comments
Assignees
Labels

Comments

@codycooperross
Copy link
Contributor

codycooperross commented Dec 8, 2023

Describe the bug

It should be possible to retrieve single Activity records via the REST API based on the id listed in the activities endpoints for a given Activity. However, attempting to retrieve an activity using its id at /activities/[id] returns a 404.

Expected Behaviour

Retrieving an Activity based on its id in the REST API returns an individual Activity record.

Current Behaviour

Retrieving an Activity based on its id in the REST API returns a 404.

Steps to Reproduce

Retrieve a list of activities at the /activities endpoint or another relevant endpoint like /dois/[doi]/activities. Attempt to retrieve a single activity using its id in the REST API at /activities/[id].

Context (Environment)

Screenshots

Further details

Proposal

Hypothesis

Possible Implementation

@codycooperross codycooperross self-assigned this Dec 8, 2023
@digitaldogsbody
Copy link
Member

I think this is probably because the id exposed by the serializer is not actually the id field: https://github.com/datacite/lupo/blob/master/app/serializers/activity_serializer.rb#L7

The controller uses a slightly weird pattern in that it calls a separate function to get the Activity record before processing the show route: https://github.com/datacite/lupo/blob/master/app/controllers/activities_controller.rb#L6 and https://github.com/datacite/lupo/blob/master/app/controllers/activities_controller.rb#L147-L151. I don't know if there is a reason for this vs what I would consider to be the standard pattern of the show controller doing the lookup (c.f. https://github.com/datacite/lupo/blob/master/app/controllers/datacite_dois_controller.rb#L435-L448)

I suspect if you used the value from the actual id field in the DB/ES record, it would probably work.

@digitaldogsbody
Copy link
Member

As a side note, /activities appears to be currently broken in test/production 😬

@codycooperross
Copy link
Contributor Author

codycooperross commented Dec 8, 2023

I suspect if you used the value from the actual id field in the DB/ES record, it would probably work.

I actually tried this, and I'm not sure it does, but worth investigating further.

As a side note, /activities appears to be currently broken in test/production 😬

We're working on this! See #1054 #1062

@svogt0511
Copy link
Contributor

Closing. Fixed by #1063

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

No branches or pull requests

3 participants