/* This script converts pages from old editor format to the new editor format from a given list of spaces The script perfomance is dependent the (No. of spaceskeys provided, pages in one space) The script correctness is dependent on the atlassian api(/wiki/rest/api/content/{id}/convert?hash=6749) that is not yet up for support*/String[]spaceKey=["<spacekey1>","<spacekey2>","..","<spacekeyN>"]// add the space keys to this list. The script will pick all the pages from this spaceKey list and convert them new editor for(inti=0;i<spaceKey.size();i++){println("SpaceKey=${spaceKey[i]}")Object[]pages=get("/wiki/rest/api/space/${spaceKey[i]}/content?childTypes.page").asObject(Map).body.page.resultsfor(intj=0;j<pages.size();j++){defstatus=put("/wiki/rest/api/content/${pages[j].id}/convert?hash=6749").asObject(Map).statusprintln("#Status-"+status)if(status>300)logger.error("Error while converting page contents from the page *title:'${pages[j].title}'* in the *spaceKey:'${spaceKey[i]}'*")elselogger.info("Successfully converted contents from the page *title:'${pages[j].title}'* in the *spaceKey:'${spaceKey[i]}'*")}}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.