Confluence Rest API - How to connect with Node.js

Hello Community,

I am having major issues trying to connect to Confluence via its REST API's.

I am utilizing Node.js as my language.

In order to connect to REST API's I am using node-rest-client dependency.

My code is as follows:

var Client = require('node-rest-client').Client;

//Credentials to log into Confluence
var loginArgs = {
data: {
"username": "myUser",
"password": "myPassword"
},
headers: {
"Content-Type": "application/json"
}
};

//REST call to my Confluence
client.post("http://confluence_host.com:8080/api/session", loginArgs, function(data, response){

if (response.statusCode == 200) {
console.log('succesfully logged in, session:', data.session);

var session = data.session;
}
});

I utlize the same code to extract data from Jira utilizing its REST API's. But Jira has a auth/1/session API and for somereason I cant seem to find any auth API for Confluence.

In Jira, the response from the session API would be cookies that I add to my header for me to validate my other REST API call's.

I cannot figure it out for Confluence.

Would anyone be able to point me in the right direction.

-Roberto 

1 answer

1 accepted

The session endpoint is not available for Confluence:
https://jira.atlassian.com/browse/CONFCLOUD-57359
I hope this helps.

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,916 views 27 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you