Data Validation The Easy Way
Written by Ian Elliot   
Article Index
Data Validation The Easy Way
Using Post for Multi-Record Query

 

The program that generated the results is also in the console and it makes a good starting point for your own program:

var url = "https://globalip.melissadata.net/
                  v4/web/iplocation/doiplocation";
url += '?' + $.param({
  't': "1",
  'id': "H5GwbLrQs93h******",
  'ip': "**.204.140.32"
});
$.ajax({
  url: url,
  method: 'GET',
}).done(function(result) {
  console.log(result);
}).fail(function(err) {
  throw err;
});

Note: asterisks used to replace characters to anonymize id and ip.

If you don't want to use jQuery you can use your own Ajax functions but there is nothing much wrong with jQuery and I'd advise using it.

There is something very confidence building when you transfer code that you know to be working to your own development environment. My advice is to modify the working code in small steps until you have what you need.

Post

As a final example I'll demonstrate how to implement the same thing using a POST.

In this case there is just one additional complication - you can submit multiple IP addresses to look up in one operation. Instead of including a single IP address in a field there is a records field where you can enter multiple IP addresses and get back multiple results.

You fill in the other fields in the usual way but the records field has the structure:

  "Records":[

   {
   "RecordID":"string","IPAddress":"string" },
   {

   "RecordID":"string", "IPAddress":"string" }, {  
    ... }

 ]

}

The only difficulty here is that the developer console doesn't give you any help in entering it - perhaps it will in the furture. Even so it is still all very easy. The recordID field is just for you to use to match up requests and responses and it can be anything you like that works.

For example:

post1

 With these parameters the results are:

post2

The generated program is:

var url = "https://globalip.melissadata.net/
              v4/web/iplocation/doiplocation";
$.ajax({
  url: url,
  method: 'POST',
  headers: {
    'Content-Type': "application/json"
  },
  data: JSON.stringify({
    'TransmissionReference': "1",
    'CustomerID': "H5GwbLrQs93hS******",
    'IPAddress': "",
    'RecordID': "0",
    'Records': [{
        'RecordID': "1",
        'IPAddress': "**.204.140.32"
      }, {
        'RecordID': "2",
        'IPAddress': "**.133.14.59"
      }]
  }),
}).done(function(result) {
  console.log(result);
}).fail(function(err) {
  throw err;
});

Note: asterisks used to replace characters to anonymize id and ip.

Of course you can get Node.js, PHP and Ruby versions by selecting the language. 

Other Services

The actual project I'm working on is a Global Email verification utility, but the workings are the same only the data changes. Melissa has databases for address, email and name validation.

mellissasq

 

There is also a U.S. Property database giving details on property and mortgage data, a person database where you can verify identity and demographic data and a business database where you can check out 25 million U.S. businesses. You can try them out using the console in the same way.

I don't think there is a DIY solution for any of these services - it would take many man hours of programming to achieve similar results without Melissa.

 

More Information

Melissa Developer Portal

Related Articles

jQuery UI and Auto-Complete Address Entry

 

Banner
 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

pythondata

 



 

Comments




or email your comment to: comments@i-programmer.info

 



Last Updated ( Saturday, 24 February 2018 )