So, I'm building my scripts to communicate with LimeLM WebAPI with NodeJS. I am using Express to easily setup the app. For one of my routes, I want to retrieve all the product keys (serials) that are associated with an email address. So, here is my code thus far for this particular route:
var express = require('express');var router = express.Router();var limelm_key = '<my secret api key>';var limelm_format = 'json';var https = require('https');var qstring = require('querystring');
router.get('/:email', function(req, res, next) {
console.log('Make a call to LimeLM endpoint with API Key: ' + limelm_key); console.log('Retrieving the keys associated with the email:' + req.params.email);
var post_data = qstring.stringify({ api_key : limelm_key, method : "limelm.pkey.find", version_id : <my version int>, email : req.params.email, format : limelm_format }); var req_opt = { host: "wyday.com", method: "POST", path: "/limelm/api/rest/", headers : { 'Content-Type' : 'application/x-www-form-urlencoded', 'Content-Length': Buffer.byteLength(post_data.length) } }
var success_callback = function(response) { console.log("Successfully called LimeLM servers!"); response.on('data', function(d) { process.stdout.write(d); }); }; console.log("Starting request to find a key using data -->"); console.log(post_data); var lime_post = https.request(req_opt, success_callback); lime_post.write(post_data); lime_post.on('error', function(e){console.error(e.stack)}); lime_post.end();});
The output generated when I hit this route is the following:
Make a call to LimeLM endpoint with API Key: <my secret api key>Retrieving the keys associated with the email: <email parameter from the get to my server>Starting request to find a key using data -->api_key=<my secret api key>&method=limelm.pkey.find&version_id=<my version id>&email=test%40somedomain.com&format=jsonSuccessfully called LimeLM servers!<?xml version="1.0" encoding="utf-8"?><rsp stat="fail"><err code="101" msg="Method "" not found"/></rsp>
Clearly, the method is there in the query string that I write, but am not certain as to why LimeLM servers are returning that it cannot find it. Any tips?
Thanks,Arie