Skip to content

List /posts/<parent>/revisions endpoint #745

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 4 commits into
base: trunk
Choose a base branch
from

Conversation

oguzkocer
Copy link
Contributor

Follows established patterns to implement list /posts/<parent>/revisions endpoint.

@oguzkocer oguzkocer added this to the 0.2 milestone May 25, 2025
Base automatically changed from delete-templates to trunk May 26, 2025 03:22
@oguzkocer oguzkocer force-pushed the list-post-revisions branch from 2d9f10a to 52cb9f6 Compare May 26, 2025 04:38
Comment on lines +132 to +137
# TODO: The following doesn't create multiple revisions, but instead updates the existing revisions which is not what we need
# # Create some exta revisions for testing
# for i in {1..10};
# do
# curl --user "$ADMIN_USERNAME":"$ADMIN_PASSWORD" -H "Content-Type: application/json" -d "{\"content\":\"content_revision_$i\"}" "http://localhost/wp-json/wp/v2/posts/$REVISIONED_POST_ID/autosaves"
# done
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@crazytonyli @jkmassel Any chance you know how to create multiple post revisions using the API? I only see the /posts/<parent_id>/autosaves endpoint for creating a revision in the documentation, but using that only creates 1 revision and overrides it for subsequent calls.

I tried sending a POST request to /posts/<parent_id>/revisions, but the server seems to interpret that as a GET request and returns the existing revisions.


I think I understand /revisions and /autosaves endpoints at a conceptual level, but I can't fully wrap my head around them in the documentation because there doesn't seem to be a POST request for /revisions. So, if either of you have extra insight about how they work, I'd appreciate it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We chatted a little bit about this with Jeremy on a Slack call and he mentioned that the revisions are most likely created on the server side when a post is updated. I'll give that a shot and update the PR accordingly.

@oguzkocer oguzkocer marked this pull request as ready for review May 26, 2025 04:45
@oguzkocer oguzkocer enabled auto-merge (squash) May 26, 2025 04:45
@oguzkocer oguzkocer requested a review from a team May 26, 2025 04:45
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.

1 participant