Skip to main content

Overview

The User API provides endpoints for retrieving and updating user information. All endpoints require authentication via token-based authentication. Base URL: /api/users/ Authentication: Token authentication required. Include the token in the Authorization header:

User Model

The User model includes the following fields:
string
required
Unique username for the user
string
Full name of the user
string
API URL for the user detail endpoint
string
User’s email address (unique)
string
User’s biography text
string
User’s location
string
URL to user’s avatar image
boolean
Whether the user’s profile is private
datetime
Timestamp when the user was created

Endpoints

List Users

Retrieve a list of users. Note: This endpoint only returns the authenticated user due to queryset filtering in footycollect/users/api/views.py:17-19. Authentication Required: Yes Response
Example Request

Retrieve User

Retrieve details for a specific user by username. Authentication Required: Yes Path Parameters
string
required
The username of the user to retrieve
Response
Example Request

Get Current User (Me)

Retrieve the authenticated user’s information. This is a custom action endpoint defined in footycollect/users/api/views.py:21-24. Authentication Required: Yes Response
Example Request

Update User

Update user information. Use PUT for full updates or PATCH for partial updates. Authentication Required: Yes Path Parameters
string
required
The username of the user to update
Request Body
string
Username (must be unique)
string
Full name of the user
Response
Example Request

Authentication

Obtain Auth Token

Obtain an authentication token for API access. Authentication Required: No Request Body
string
required
User’s username
string
required
User’s password
Response
Example Request

Error Codes

Bad Request
The request was malformed or contains invalid data
Unauthorized
Authentication credentials were not provided or are invalid
Forbidden
You don’t have permission to access this resource
Not Found
The requested resource was not found
Internal Server Error
An error occurred on the server

Notes

The UserViewSet uses username as the lookup field instead of the default ID. All user detail endpoints use the username in the URL path.
The list users endpoint is filtered to only return the authenticated user. This is implemented in footycollect/users/api/views.py:17-19 via the get_queryset method.
For full interactive API documentation with the ability to test endpoints, visit /api/docs/ when running the FootyCollect server.