Skip to content

Using confluence.putContent moves page out from under parent #22

Open
@jawa9000

Description

@jawa9000

Maybe I'm not doing something right here but when I execute the following, the page in question does get updated but it is moved out from under it's parent page and moved to the top of the space.

confluence.putContent(spacekey, pageId, version, title, content, function(err, data) {...});

I've verified that the all the required variables are correct and I do not get any errors.

More details: here is the complete function I'm trying to use. First, I use postContentByPageTitle method to get the pageId and version info. Then I pass those variables to the putContent method to update the target page.

function postContentByPageTitle(spacekey, title, content) { 
  setTimeout(function() {
    console.log('Placing content in ' + spacekey + ':' + title + '.');
    confluence.getContentByPageTitle(spacekey, title, function(err, data) {
      try {
        if (data.results[0].id) {
          var version = parseInt(data.results[0].version.number) + 1;

          confluence.putContent(spacekey, data.results[0].id, version, title, content, function(err, data) {
            if (err) {
              console.log(err);
            } else {
              console.log('  ' + title + ' has been updated.')
            }
          });
        }
      }
      catch(error) { 
        console.log(error)
      }
    });
  }, arguments.delay);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions