This is the Django RESTful API Documentation. For ease of consumption, the tables are grouped based on endpoint base.

The Opportunity Endpoints:

EndpointHTTP MethodsDescriptionParametersResponse Example
/api/email_opportunity/GET– GET: Retrieve a list of all email opportunities.None for GET– GET: List of email opportunities.
POST– POST: Create a new email opportunity.POST: JSON body– POST: Status 201 Created on success.
/api/email_opportunity/{id}GET– GET: Retrieve a specific email opportunity.id (URL parameter)– GET: Details of the specific email opportunity.
PUT– PUT: Update a specific email opportunity.– PUT: Status 204 No Content on success.
DELETE– DELETE: Delete a specific email opportunity.– DELETE: Status 204 No Content on success.
/api/email_opportunity/active/GETRetrieve all active email opportunities for the authenticated user, excluding certain statuses.NoneList of active email opportunities.

The Job Site Endpoints:

EndpointHTTP MethodDescriptionParametersResponseStatus Codes
/api/job_site/GETRetrieves a list of job sites associated with the authenticated user.No parameters.List of serialized job sites associated with the user.200 OK
/api/job_site/POSTCreates a new job site for the authenticated user.Request body must include job site data (e.g., name, description).Success: Returns status 201 if job site is created successfully. Error: Returns validation errors if data is invalid.201 Created, 400 Bad Request
/api/job_site/([0-9]*)/postingsGETRetrieves a list of job postings associated with a specific job site.job_site_id (integer) — the ID of the job site.List of job postings for the specified job site.200 OK
/api/job_site/([0-9]*)/postingsPOSTCreates a new job posting associated with a specific job site.job_site_id (integer) — the ID of the job site, request body includes job posting data (e.g., job title, description).Success: Returns status 201 if job posting is created. Error: Returns validation errors if data is invalid.201 Created, 400 Bad Request
/api/job_site/([0-9]*)GETRetrieves details of a specific job site based on its primary key (ID).pk (integer) — the ID of the job site.Details of the job site (serialized data).200 OK
/api/job_site/([0-9]*)PUTUpdates an existing job site associated with the authenticated user.pk (integer) — the ID of the job site, request body must include updated job site data.Success: Returns status 204 if job site is updated. Error: Returns validation errors if data is invalid.204 No Content, 400 Bad Request, 403 Forbidden
/api/job_site/([0-9]*)DELETEDeletes a specific job site associated with the authenticated user.pk (integer) — the ID of the job site.Success: Returns status 204 if job site is deleted.204 No Content, 403 Forbidden

Job Posting Endpoints:

Endpoint NameHTTP MethodDescriptionParametersResponseStatus Codes
/api/job_posting/active/GETRetrieves the active job postings for the authenticated user, filtering based on status.No parameters, requires authenticated user.List of active job postings for the user.200 OK, 401 Unauthorized, 204 No Content
/api/job_posting/GET– GET: Retrieves a list of job postings for the authenticated user.GET: No parameters, requires authenticated user.– GET: List of job postings.200 OK, 201 Created, 400 Bad Request, 401 Unauthorized
POST– POST: Creates a new job posting for the authenticated user.POST: company_name, posting_title, etc.– POST: Status 201 Created on success, or validation errors.
/api/job_posting/([0-9]+)GET– GET: Retrieves the details of a specific job posting.pk: The ID of the job posting.– GET: Serialized job posting details.200 OK, 204 No Content, 400 Bad Request, 403 Forbidden, 404 Not Found
PUT– PUT: Updates a specific job posting.– PUT: Status 204 No Content on success.
DELETE– DELETE: Deletes a specific job posting.– DELETE: Status 204 No Content.
/api/report/(?P\w+)/?(?P\d{4}-\d{2}-\d{2})?/?$GETRetrieves a report based on the report type and optional reference date.
Valid report types: postingsAppliedSince, perSite, perWeek.
report_type: The report type (postingsAppliedSince).
reference_date: Optional date (ISO format).
A generated report based on the specified type. Contains metadata and report data.200 OK, 400 Bad Request, 401 Unauthorized

User Authentication and Profile Endpoints:

Endpoint NameHTTP MethodDescriptionParametersResponseStatus Codes
register_userPOSTRegisters a new user with provided details, including required and optional fields.username (string),
email (string),
first_name (string), last_name (string),
password (string)
On success: {“message”: “User successfully registered.”}
On failure: {“error”: “Username already exists.”}
201 Created, 400 Bad Request
authenticate_userPOSTAuthenticates a user and returns JWT tokens for successful login.username (string), password (string)On success: {“access”: “access_token”, “refresh”: “refresh_token”, “user”: {user data}}
On failure: {“error”: “Invalid credentials.”}
200 OK, 400 Bad Request, 401 Unauthorized
logout_userPOSTLogs out a user by blacklisting the refresh token.refresh (string)On success: {“detail”: “Successfully logged out.”}
On failure (no token): {“detail”: “No refresh token provided.”}
On failure (invalid token): {“detail”: “Invalid token.”}
200 OK, 400 Bad Request
update_user_infoPUTAllows an authenticated user to update their profile information.first_name (string), last_name (string),
email (string),
password (string, optional)
On success: {“message”: “User info updated successfully.”}
On failure: {“email”: [“Enter a valid email address.”]}
200 OK, 400 Bad Request
list_all_usersGETRetrieves a list of all users (admin access required).NoneOn success: [{user data}, {user data}, …]200 OK, 403 Forbidden
token_obtain_pairPOSTObtains JWT tokens using credentials for authentication.username (string), password (string)On success: {“access”: “access_token”, “refresh”: “refresh_token”}
On failure: {“detail”: “Invalid credentials.”}
200 OK, 400 Bad Request
token_refreshPOSTRefreshes an expired JWT access token using the provided refresh token.refresh (string)On success: {“access”: “new_access_token”}
On failure: {“detail”: “Token refresh failed. Please log in again.”}
200 OK, 401 Unauthorized, 500 Internal Server Error
user_profileGETRetrieves the profile data of the current authenticated user.NoneOn success: {“id”: 1, “username”: “john_doe”, “email”: “john_doe@example.com”, “first_name”: “John”, “last_name”: “Doe”}200 OK, 401 Unauthorized