Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7577549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:13:00+00:00 2026-05-30T17:13:00+00:00

I am doing a Rest call in nodejs to get a report from JasperSoft

  • 0

I am doing a Rest call in nodejs to get a report from JasperSoft Server.
And
I need to get a cookie to stay connected but I don’t know how to do get it

var http = require('http');
var options = {
  host: '127.0.0.1',
  port: 8080,
  path: '/jasperserver/rest/login?j_username=jasperadmin&j_password=jasperadmin',
  method: 'POST'
};

http.request(options, function(res) {

  console.log('STATUS: ' + res.statusCode);
  console.log('HEADERS: ' + JSON.stringify(res.headers));

  res.setEncoding('utf8');
  res.on('data', function (chunk) {
    console.log('BODY: ' + chunk);

  });
}).end();

So it work but then I want to have acces to another link like
:localhost:8080/jasperserver/ressource/reports
And I need the cookie to do that. How can I do to get it ?

For your informations, console.log(‘HEADERS: ‘ + JSON.stringify(res.headers));
display the cookie and the path and some other thing, so maybe i just have to parse it and get the cookie from there but I don’t know how to do.

Moreover, as I said I want to go to another link after being connected so can you also help me to set the cookie for another link ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:13:01+00:00Added an answer on May 30, 2026 at 5:13 pm

    Look into using Mikeal Rogers’ request module. It has built-in cookie handling, follows redirects, and other goodies. It’s also a little simpler API than http.request. Your cookies should just work after logging in.

    Update: Sample with request (npm install request):

    var request = require("request");
    
    request.post({url: "http://localhost:8080/jasperserver/rest/login", qs: {j_username: "jasperadmin", j_password: "jasperadmin"}}, function(err, res, body) {
        if(err) {
            return console.error(err);
        }
    
        request.get("http://localhost:8080/jasperserver/ressource/reports", function(err, res, body) {
            if(err) {
                return console.error(err);
            }
    
            console.log("Got a response!", res);
            console.log("Response body:", body);
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing a rest call and getting a json file from the server
I need to POST a REST service call and get the data it returns
Am doing a GET(REST) and using InternetReadFile API to read response which is an
Hey, I am doing to AJAX call to flickr.interestingness.getList to get the interesting pictures
I need to call my WCF REST Service with multiple parameters with the POST
Does anyone know if (and how) I can build an application (Java/Ruby/whatever) doing REST
I understand how to use REST for doing general entity interactions - using urls
Doing an ajax get request works as expected using the following code: $.ajax({ type:
I am running an Apache 2.2.3 proxy server to hide my backend machines from
I'm retrieving content via a jQuery get Ajax call and add it to an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.