dotCMS / dotCMS/core

Enhancement Request: Improve Job Listing API for Better Usability and Maintenance

Open
#30,667 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Team : Scout Type : New Functionality
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Parent Issue

https://github.com/dotCMS/core/issues/29498

User Story

The current implementation of the /api/v1/jobs/completed endpoint returns detailed job results for completed jobs, including extensive error logs and metadata. This creates unnecessary overhead when listing or paginating through large numbers of completed jobs, particularly when dealing with jobs that have many errors or warnings.

For example, a large import job with errors generates a response like this:

{
"progress": 1.0,
"queueName": "importContentlets",
"result": {
"errorDetail": null,
"metadata": {
"errors": [
"Line #2 contains errors. URL is malformed or Response is not 200",
"Line #3 contains errors. URL is malformed or Response is not 200",
...
],
"warnings": [
"Header 'languageCode' doesn't match any Content Type field; this column of data will be ignored.",
...
],
...
}
},
...
}

it's extensively large like 800 lines

Acceptance Criteria

Proposed Enhancements:

1.	Summarized Responses for Listing Endpoints:
	Modify the /api/v1/jobs/completed \(and similar endpoints for failed jobs\) to return summary data only.
	Include key attributes such as:
	id
	state
	progress
	queueName
	startedAt
	updatedAt

	Omit detailed metadata, warnings, and errors to reduce response size.

2.	Detailed Endpoint for Job Data:
	Full info should only be returned through a dedicated job, e.g., /api/v1/jobs/{jobId}, to return the full details of a specific job.
	This lets clients fetch detailed information on demand for a specific job without overloading listing endpoints.

3.	Cleanup Endpoint for Old Jobs:
	Add an endpoint to clean up old or failed jobs, e.g., /api/v1/jobs/cleanup, with parameters for filtering \(e.g., state, date range\).
	This would help manage and maintain job history efficiently, avoiding performance issues caused by accumulating old data.

Benefits:

	Improved Performance: Paginated endpoints will be faster and lighter by omitting unnecessary data.
	Better Usability: Developers can focus on the summaries for listings and retrieve details only when needed.
	Enhanced Maintenance: A cleanup endpoint helps avoid bloated job histories, ensuring the system remains performant over time.

Affected Endpoints:

•	/api/v1/jobs/completed
•	/api/v1/jobs/failed
Proposed Objective

Technical User Experience

Proposed Priority

Priority 3 - Average

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the handlers for /api/v1/jobs/completed and /api/v1/jobs/failed, then compare how detailed job data is exposed. Define the summary fields and the dedicated /api/v1/jobs/{jobId} response, and determine the filtering behavior for /api/v1/jobs/cleanup. Done means listing responses omit metadata, details remain available on demand, and old jobs can be cleaned up using the requested filters.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.