title: Trying to connect to LinkedIn API with Node.js Express
body: <p>I'm having trouble connecting to, and pulling connections from, <code>Linkedin</code>. I have to use <code>nodejs</code> and <code>express</code>, and am using the linkedin-js client (<code>https://github.com/masylum/linkedin-js</code>). I have looked everywhere for examples and still don't quite understand how to do the "get" call and display a users connections on the page. I'm getting an error when I use "render", but when I try to use "send" instead, I find that the API call isn't working anyways. Anyone's help and explanation would be greatly appreciated! Here's what I have so far.</p>
  
  <pre><code>var express = require('express')
  , linkedin_client = require('linkedin-js')('xxx', 'xxx', 'http://localhost:3003/')
  , app = express();
  
  app.configure(function(){
  
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(express.static(__dirname + '/'));
  app.use(express.cookieParser());
  app.use(express.session({ secret: "string" }));  
  });
  app.get('/', function (req, res) {
  // the first time will redirect to linkedin
   linkedin_client.getAccessToken(req, res, function (error, token) {
  // will enter here when coming back from linkedin
  req.session.token = token;
  
  
   linkedin_client.apiCall('GET', '/people/~/connections:(headline,first-name,last-name)',
  {
    token: {
      oauth_token_secret: req.session.token.oauth_token_secret
    , oauth_token: req.session.token.oauth_token
    }
  , fields: req.param('id')//not sure?
  }
  , function (error, result) {
    res.send('message_sent');
  }
  );
  //res.render('auth');  I'm getting an error here as well
  });
  });
  
  
  
  app.post('/message', function (req, res) {
  linkedin_client.apiCall('POST', '/people/~/shares',
  {
    token: {
      oauth_token_secret: req.session.token.oauth_token_secret
    , oauth_token: req.session.token.oauth_token
    }
  , share: {
      comment: req.param('message')
    , visibility: {code: 'anyone'}
    }
  }
  , function (error, result) {
    res.render('message_sent');
  }
  );
  });
  
  
  
  
  
  app.listen(3003);
  console.log("Listening");
  </code></pre>