core icon indicating copy to clipboard operation
core copied to clipboard

Enhance POST /api/v2/tags/import endpoint (Tag Import from CSV)

Open hassandotcms opened this issue 1 year ago • 1 comments

Task

Context: Part of Feature #32943 (Import/Export Tags) in Tags Portlet Modernization Epic. Implements tag import from CSV with row-level error reporting and validation.

Definition of Done:

  • Accepts multipart/form-data with CSV file
  • CSV format validation: "Tag Name,Host ID" headers
  • Automatic header row detection and skipping
  • Row-level processing with individual error reporting
  • Tag name validation (cannot be empty)
  • Host ID fallback to current site/SYSTEM_HOST
  • Synchronous processing with immediate results
  • Response: totalRows, processedRows, successfulImports, errorRows
  • Detailed rowErrors with lineNumber, messages, field info
  • Error responses: 400, 401, 403, 500
  • Postman tests with sample CSV files

Proposed Objective

Same as Parent Issue

Proposed Priority

Same as Parent Issue

Acceptance Criteria

  1. Processes CSV with "Tag Name,Host ID" format
  2. Skips header row automatically
  3. Empty tag names fail with specific row error
  4. Invalid host IDs fall back to current site
  5. Returns success count and detailed failures
  6. Missing file returns 400
  7. Row errors include line number and field
  8. File processing errors return 500

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

hassandotcms avatar Aug 11 '25 15:08 hassandotcms