Skip to content

[6.0] Tag history endpoint #44669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: 6.0-dev
Choose a base branch
from
Open

Conversation

alikon
Copy link
Contributor

@alikon alikon commented Dec 26, 2024

Summary of Changes

added endpoints for tags history

  • GET v1/tags/:id/contenthistory
  • PATCH v1/tags/:id/contenthistory/keep
  • DELETE v1/tags/:id/contenthistory

Testing Instructions

npm cypress run --spec tests/System/integration/api/com_contenthistory/Tag.cy.js

Actual result BEFORE applying this Pull Request

N/A

Expected result AFTER applying this Pull Request

test + endpoint

Link to documentations

As discussed, this API enhancement will be documented first in https://manual.joomla.org/migrations/54-60/new-features, please note:

  • id for /v1/tag/:id/contenthistory is the contenthistory id and NOT the tag.id
  • PATCH is only available for the attribute keep_forever with /v1/tag/:id/contenthistory/keep

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@alikon alikon marked this pull request as ready for review December 26, 2024 18:32
@alikon alikon closed this Mar 24, 2025
@alikon alikon reopened this May 15, 2025
@alikon alikon changed the base branch from 5.3-dev to 5.4-dev May 15, 2025 10:23
@alikon alikon changed the title [5.3] Tag history endpoint [5.4] Tag history endpoint May 15, 2025
@muhme
Copy link
Contributor

muhme commented May 16, 2025

Thank you @alikon for your contribution and for adding System Tests for the new REST API tag history functionality.

Is it possible to also test PATCH and DELETE requests in the System Tests after testing GET?

I would test in parallel with curl or postman and document this as the mentioned System Test spec is already included in the CI. And would ask around how to proceed with the documentation, e.g. there is no POST as the history entries are only created implicit.

@alikon
Copy link
Contributor Author

alikon commented May 18, 2025

yes, of course
but i'll be slow, i'm short in free time currently

@richard67 richard67 changed the base branch from 5.4-dev to 6.0-dev June 8, 2025 13:52
@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-6.0-dev labels Jun 8, 2025
@richard67 richard67 changed the title [5.4] Tag history endpoint [6.0] Tag history endpoint Jun 8, 2025
@richard67
Copy link
Member

@alikon We have discussed this PR among release managers and decided to move it to 6.0-dev as it's a new feature, so I've just rebased your PR. Now it shows 2 unrelated changes, but these will disappear after the next upmerge and branch update.

@muhme
Copy link
Contributor

muhme commented Jun 9, 2025

I have tested this item 🔴 unsuccessfully on 5933d36


I have tested with current 6.0-dev and curl command line (script and output will be attached to the PR)

  • ✅ With wrong API token
    • GET /v1/tags/:id/contenthistory -> 401 "Unauthorized" with error "Forbidden"
    • PATCH /v1/tags/:id/contenthistory/keep -> 401 "Unauthorized" with error "Forbidden"
    • DELETE /v1/tags/:id/contenthistory -> 401 "Unauthorized" with error "Forbidden"
  • GET /v1/tags/:id/contenthistory -> 200 "OK" and returning the entry in JSON format
  • PATCH /v1/tags/:id/contenthistory/keep -> 200 "OK" and empty return
    • ✅ And verified next GET has "keep_forever" : 1 set
  • DELETE /v1/tags/:id/contenthistory -> 204 "No Content" end no content returned
  • ❌ Non existing entries, expected is e.g. 404 "Not Found"
    • GET /v1/tags/4711/contenthistory -> 200 "OK" and json structure with self link and empty data and empty meta
    • PATCH /v1/tags/4711/contenthistory/keep -> 400 "Bad Request" with JSON error "Changed the keep forever value for a history version."
    • DELETE /v1/tags/4711/contenthistory -> 500 "Internal Server Error" with JSON error "RuntimeException"

Not tested was the following. Should this or something elso be tested next time?

  • PATCH with malformed JSON
  • PATCH with unsupported fields

The database was checked in parallel and regardless of this PR, the entries in the content history are not deleted when the tag is deleted and I will create an issue.

Notes on the documentation:

  • id for /tags/:id/contenthistory is the contenthistory and NOT the tag.id
  • PATCH is only available for the attribute keep_forever with /v1/tags/:id/contenthistory/keep

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44669.

Files

@alikon
Copy link
Contributor Author

alikon commented Jun 10, 2025

for the DELETE of a non existent item see #45589

for the GET it is the current behaviour of contenthistory not only for tags

for the PATCH need some more free time to check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants