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

  • Home
  • SEARCH
  • 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 6094359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:40:06+00:00 2026-05-23T12:40:06+00:00

I am currently fiddling around with Node.JS to try to create a package for

  • 0

I am currently fiddling around with Node.JS to try to create a package for PostageApp to be able to send emails through our API.

To start, I am using the following code to test out how Node.JS can best interface with our API, but it doesn’t seem to want to pass along the API key that I have attached as part of the headers.

var http = require('http');

function onRequest(request, response) {
  response.end();
}

http.createServer(onRequest).listen(8888);
console.log("Server has started.");

var options = {
    host: 'api.postageapp.com',
    path: '/v.1.0/get_account_info.json',
    method: 'POST',
    headers: { "api_key" : "MY API KEY HERE" }
};

var req = http.request(options, function(res) {
    console.log('STATUS: ' + res.statusCode);
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log('BODY: ' + chunk);
    });
});

req.end();
console.log("Request sent!");

I pulled this together using various examples and what not – it’s not pretty, I know. However, using HTTPS, I finally got it to hit our API and get a response:

{"response":{"status":"unauthorized","message":"Invalid or inactive API key used","uid":null}}

The only conclusion I can come up with is that the API key is not getting passed along, and I would appreciate any help as to how to make that happen.

Thanks!

  • 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-23T12:40:07+00:00Added an answer on May 23, 2026 at 12:40 pm

    Here’s an example of code I have used to call web APIs with a key in the header:

      var api = http.createClient(80, 'api.example.org');
    
      var request = api.request('GET', '/api/foo', 
        {
          'host': 'api.example.org',
          'accept': 'application/json', 
          'api-key': 'apikeygoeshere' 
        });
    
      request.on('response', function (response) {});    
      request.end();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently still fiddling with our msbuild & deployment script and one of
I'm currently fiddling around with JSON - but I can't get jQuery's $.ajax method
I am currently reading a book about bit fiddling and the following formula appears:
I'm currently in the middle of a project that involves YouTube API. I'm using
I have Ubuntu, and installed the phpMyAdmin package (currently 4:3.3.2-1). Every 30 minutes, it
So been fiddling around with this for a while now but still no luck.
I came across a problem in my current application that required fiddling with the
Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and
Currently my workflow with Emacs when I am coding in C or C++ involves
Currently we have a hybrid ASP/PHP setup connecting to a SQL Server 2005 database.

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.