node js call to confluence API returns null

368 views Asked by At

Hi I am new to using node and rest API calls.

I found this node js wrapper for confluence APIs: https://github.com/johnpduane/confluence-api#Confluence+getSpace

var Confluence = require("confluence-api");
var config = {
username: "<user>",
password: "<pw>",
baseUrl:  "https://<page>.atlassian.net",
};
var confluence = new Confluence(config);
confluence.getSpace(<space name>, 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)
console.log(data.results[0].id);
});

The return of this is null. I am not sure what this means -- am I not connecting through to my confluence page? Am I misunderstanding how to use API calls?

1

There are 1 answers

0
Avinash On

First of all, you have to details about your confluence page. baseurl:your confluence url,https://yourdomain/confluence.rest/api/content username, password the same you login into your confluence. space: space name version: if you want to update your page through node.js code body: data