This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

Source code for galaxy.webapps.galaxy.api.page_revisions

API for updating Galaxy Pages

import logging

from galaxy.managers.base import get_object
from galaxy.managers.pages import (
from galaxy.web import expose_api
from . import (

log = logging.getLogger(__name__)

[docs]class PageRevisionsController(BaseGalaxyAPIController): manager: PageManager = depends(PageManager)
[docs] @expose_api def index(self, trans, page_id, **kwd): """ index( self, trans, page_id, **kwd ) * GET /api/pages/{page_id}/revisions return a list of Page revisions :param page_id: Display the revisions of Page with ID=page_id :rtype: list :returns: dictionaries containing different revisions of the page """ page = get_object(trans, page_id, "Page", check_ownership=False, check_accessible=True) r = get_page_revision(trans.sa_session, page.id) out = [] for page in r: as_dict = self.encode_all_ids(trans, page.to_dict(), True) self.manager.rewrite_content_for_export(trans, as_dict) out.append(as_dict) return out
[docs] @expose_api def create(self, trans, page_id, payload, **kwd): """ create( self, trans, page_id, payload **kwd ) * POST /api/pages/{page_id}/revisions Create a new revision for a page :param page_id: Add revision to Page with ID=page_id :param payload: A dictionary containing:: 'content' = New content of new page revision :rtype: dictionary :returns: Dictionary with 'success' or 'error' element to indicate the result of the request """ page = get_object(trans, page_id, "Page", check_ownership=True) page_revision = self.manager.save_new_revision(trans, page, payload) rval = self.encode_all_ids(trans, page_revision.to_dict(view="element"), True) self.manager.rewrite_content_for_export(trans, rval) return rval