Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
ECONNRREFUSED Error when making a get request to an API with Nodejs

I did make a get request to an API but get an ECONNREFUSED Error. The problem is not the API because when I type it in a browser, I get back results in JSON.

This is my code;

var https = require("https");

var options = {
    host :  'nairabox.com',
    port : 443,
    path : '/v1/tickets/auth=APIKEY&as=showtimes&cinemaId=CINEMAID&ticketId=TICKETID',
    method : 'GET'
}


var req = https.request(options, function(res) {
  res.on('data', function(data) {
      console.log( JSON.parse(data));
  });
});

req.end();

req.on('error', function(err){
    console.log("Error: ", err);
}); 

This is the error;

Error:  { Error: connect ECONNREFUSED 162.255.119.75:443
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '162.255.119.75',
  port: 443 }

Anyone can be kind enough to test it replacing the parameters with random numbers and you'd get the same error. How can I fix it. API gives results in the browser though.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The hostname nairabox.com resolves to two IP-numbers, 178.79.175.127 and 162.255.119.75. The latter is refusing connections, which is the issue you're running in to.

However, the host www.nairabox.com resolves to only one IP-number, 178.79.175.127, so I guess you should be using that hostname instead of the one without the www. prefix.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda