Skip to content

Added endpoint to modify or add tags via API#2

Open
ArturoAvendano wants to merge 3 commits into
codewizdevs:mainfrom
whitestack:main
Open

Added endpoint to modify or add tags via API#2
ArturoAvendano wants to merge 3 commits into
codewizdevs:mainfrom
whitestack:main

Conversation

@ArturoAvendano

Copy link
Copy Markdown

Hi, i would like to contribute the present PR to add tags via API, as the name says, it adds additional functionality to add tags, feel free to reach out to me to correct or expand the code, best wishes.

Copilot AI review requested due to automatic review settings June 8, 2026 21:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds administrative CRUD support for tags via the REST API and updates docs/UI examples plus smoke coverage to match.

Changes:

  • Implemented POST /api/v1/tags, PATCH /api/v1/tags/:id, and DELETE /api/v1/tags/:id (admin + write scope) with audit logging.
  • Added tag lookup helpers (getTagListed, getTagByName) including site_count to support API responses.
  • Updated README, settings page examples, and smoke tests to document and verify the new endpoints.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
views/settings-api-tokens.ejs Adds curl examples for creating monitors and tags via API tokens
src/routes/api.js Adds tags create/update/delete endpoints and helpers in the API router
src/lib/tags.js Adds DB helpers to fetch tags with site_count and by name
scripts/smoke-features.sh Extends smoke script to exercise tags CRUD and scope enforcement
README.md Documents tags API semantics and adds example commands
PLAN.md Updates API endpoint plan list to include tag write endpoints

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/routes/api.js
Comment on lines +315 to +317
function isUniqueConstraintError(err) {
return String(err?.message || '').toLowerCase().includes('unique');
}
Comment thread src/routes/api.js
Comment on lines +89 to +101
async function loadTag(req, res) {
const id = parseId(req.params.id);
if (id == null) {
res.status(404).json({ error: 'not found' });
return null;
}
const row = await tagsLib.getTagListed(id);
if (!row) {
res.status(404).json({ error: 'not found' });
return null;
}
return row;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants