fix(api): make record GET endpoint publicly accessible without authentication
Here is a clean Merge Request title and description in a professional format.
MR Title
feat(api): make record GET endpoint publicly accessible without authentication
MR Description
Summary
This merge request updates the record retrieval endpoint to allow public, unauthenticated access to record data. This enables users to view shared record pages without being redirected to the login page.
Problem
Previously, the GET /api/v1/records/{record_id} endpoint required authentication. As a result:
- Unauthenticated users were redirected to
/login - Shared record links could not be viewed publicly
- Read-only access to records was unnecessarily restricted
Changes Made
before tried to get record asking auth
after changes the record fetch without auth or access token
Backend
-
Removed authentication dependency from:
GET /api/v1/records/{record_id}
-
Preserved authentication requirements for all write and action endpoints, including:
- Create record
- Update record
- Delete record
- Contribute to record
- Download protected content
- Like and comment actions
Tests
-
Added integration tests to verify:
- Unauthenticated requests to the GET endpoint return
200 OK - Valid record data is returned without requiring a token
- Protected endpoints continue to require authentication
- Unauthenticated requests to the GET endpoint return
Files Modified
app/api/v1/endpoints/records.pytests/integration/api/test_records_public_access.py
Acceptance Criteria
-
GET /api/v1/records/{record_id}is accessible without authentication -
Unauthenticated requests return 200 OKwith record data -
Invalid record IDs return 404 Not Found -
All write/action endpoints remain protected -
Existing authenticated functionality remains unchanged
Testing Performed
- Started the backend server locally.
- Opened Swagger documentation at
http://localhost:8000/docs. - Executed
GET /api/v1/records/{record_id}without using the Authorize button. - Confirmed the endpoint responded successfully without requiring authentication.
- Verified that protected endpoints still display authentication requirements.
- Ran integration tests covering public access behavior.
Impact
This change enables public sharing of record pages while maintaining authentication for all modification and contribution actions.

