Skip to content
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

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

Open
jawa9000 opened this issue Feb 13, 2019 · 0 comments
Open

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

jawa9000 opened this issue Feb 13, 2019 · 0 comments

Comments

@jawa9000
Copy link

jawa9000 commented Feb 13, 2019

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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant