GithubHelp home page GithubHelp logo

confluence-api's People

Contributors

arthmoeros avatar johnpduane avatar lukouko avatar mlersch avatar qvaqvaboo avatar rnhurt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

confluence-api's Issues

Make APIs consistent

postContent and putContent callback positions are inconsistent other APIs. I'm happy to make a PR (with backward compatibility). LMK ๐Ÿ‘

Allow for use of proxy

There should be an option that you can pass in the config to set a proxy. There is a library that extends superagent to allow for a proxy, see here.

Documentation missing examples, showing how to use library

I've got a site that needs to be imported into Confluence. People will view it in Confluence but it is not the authoritative source and so it needs to be imported often so Confluence gets the latest changes. I was looking at your library and at confluency. That other library has some useful functions, especially around dealing with children and retrieving all pages within a site. I would potentially use both during the import of this site to Confluence.

I want to also try out yours but the documentation is missing examples. In particular, I was hoping that .getCustomContentById() would be powerful enough to get a list of children and maybe I could update pages with .putContent(). It is difficult for me to divine how to use these methods when the totality of their documentation is a brief sentence and an explanation of parameter types.

Would you be willing to show examples in your readme? Also, is this library able to get all of the pages in a single space and get all of the children for a single page? Right now it appears that I will be using two Confluence libraries in order to scan for all pages (confluency), upload new pages by title (confluence-api), change page parents (both) and delete pages (both).

Promise-based API

Would be real cool if these API calls would return a Promise and be chainable. Nothing wrong with callbacks to get the job done, but currently I am finding that I need to wrap everything in a promise which is a little annoying. Ideally we'd support both.

I can help with this by creating a PR, just let me know if that's something we'd want to do.

getUserByKey

Hey there,

I've implemented a getUserByKey function, added documentation, and created a test (which needs a valid userKey to be added to pass, but which otherwise should). I've never submitted a pull request before, but it seems like I need permission to create the branch and then submit the request -- or let me know if there's some other way you'd rather I submitted.

Thanks for building this, it's been super helpful!

Using confluence.putContent moves page out from under parent

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);
}

ERROR TypeError: Cannot read property 'body' of undefined

On Heroku I get the above error, the whole stacktrace looks like this:

[Fri Apr 22 2016 11:42:28 GMT+0200 (CEST)] ERROR TypeError: Cannot read property 'body' of undefined
  at /app/node_modules/confluence-api/lib/confluence.js:162:34
  at Request.callback (/app/node_modules/confluence-api/node_modules/superagent/lib/node/index.js:687:12)
  at ClientRequest.<anonymous> (/app/node_modules/confluence-api/node_modules/superagent/lib/node/index.js:639:10)
  at CleartextStream.read [as _read] (tls.js:472:13)
  at ClientRequest.emit (events.js:95:17)
  at SecurePair.emit (events.js:92:17)
  at CleartextStream.socketErrorListener (http.js:1603:9)
  at CleartextStream.emit (events.js:95:17)
  at SecurePair.<anonymous> (tls.js:1400:19)
  at CleartextStream.Readable.read (_stream_readable.js:341:10)
  at writeOrBuffer (_stream_writable.js:216:5)
  at SecurePair.maybeInitFinished (tls.js:980:10)
  at doWrite (_stream_writable.js:226:10)
  at EncryptedStream.Writable.write (_stream_writable.js:183:11)
  at EncryptedStream.write [as _write] (tls.js:369:25)
  at write (_stream_readable.js:602:24)
  at flow (_stream_readable.js:611:7)
  at emitReadable_ (_stream_readable.js:427:10)
  at Socket.pipeOnReadable (_stream_readable.js:643:5)
  at emitReadable (_stream_readable.js:423:5)
  at Socket.emit (events.js:92:17)
  at readableAddChunk (_stream_readable.js:166:9)
  at Socket.Readable.push (_stream_readable.js:128:10)
  at TCP.onread (net.js:529:21)      

The same code works without problems locally, any idea what can be wrong?

calls returning null?

ar Confluence = require("confluence-api");
var config = {
username: ""
password: "",
baseUrl: "https://.atlassian.net",
//version: 4 // Confluence major version, optional
};
var confluence = new Confluence(config);
confluence.getSpace("", function(err, data) {
// do something interesting with data; for instance,
// data.results[0].body.storage.value contains the stored markup for the first
// page found in space 'space-name' matching page title 'page-title'
console.log(data)
console.log(err)

});

when I run this the output is a {} and a null.
I know that there is a space and that it has information inside it.
This is connecting to a confluence cloud instance.

Not able to put correctly (likely user error)

First off great repo thank you!!!

I have getContentByID working however im struggling to get putContent to work. Im fairly sure the issue lies in the sting passed to the content parameter.

  confluence.putContent(
    "AI",
    "1234567",
    "2",
    "Name of document",
    '"body":{"storage":{"value":"<p>This is the updated text for the new page</p>","representation":"storage"}',
    (err, data) => {
      console.log("Started");
      if (err) {
        callback(null, { statusCode: 405, body: JSON.stringify(err) });
      } else {
        console.log(data);
        callback(null, { statusCode: 200, body: JSON.stringify(data) });
      }
    }
  );

Is my content sting malformed?

Not able to put the content in an existing page in a space.

Hi,

I am facing an issue, i am not able to update the content of available page in confluence. This is my sample request.

confluence.putContent(<space_id>,<page_id>,<current_versionId>, 'Test Page', '<h1>Updated</h1>', function (err, response) {
    if (!err) {
        console.log('Done');
    } else {
        console.log(err.message);
    }
}, true);

When i run this, i am getting "Conflict" as an error response.

I tried to increment the version ID of the to the same page, but i am returning with "BAD REQUEST" as an error response.

Add ancestors to put request

First of all, thanks for a nice module. :)

It would be great to be able to use ancestors in the put request to put the page at the desired location/path in the same request. (E.g. the same place it was before the put.)

I will be happy to send a pull request but I would like to have your thoughts on how to implement it.
If you think it's worth implementing at all, that is.
Perhaps a new function could be implemented with options like the getCustomContentById?

Custom Expanders

I need to be able to provide custom expanders to getContentById. I can see in the current code that expand fields default to body.storage,version.

Two possible options;

  • Change getContentById to process variable number of arguments. Second optional argument would be expanders which is basically an array of expanded fields. Acceptable signatures would be:
    getContentById(id, cb) or getContentById(id, expanders, cb). In the former case, the current default expansions would be used. In the latter case, expanders would override default.
  • Add a new function: getExpandedContentById(id, expanders, cb)

Please let me which is preferred, happy to branch and provide pull request.

Error : Request has been terminated

Hi!

When I try confluence-api I have Error :
Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.

I select Enable development mode in my confluence cloud.

Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.