Last active
August 29, 2015 14:23
-
-
Save MatthewRDodds/e59f0dcd373025ce5f27 to your computer and use it in GitHub Desktop.
MelissaData JSON Request Ruby Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'rest-client' | |
message = { | |
'TransmissionReference' => 'Sample', | |
'CustomerID' => ENV['CUSTOMER_ID'], | |
'Actions' => 'Check', | |
'Options' => nil, | |
'Columns' => nil, | |
'Records' => [{ | |
'RecordID' => '1', | |
'CompanyName' => nil, | |
'FullName' => nil, | |
'AddressLine1' => '22382 Avenida Empresa', | |
'AddressLine2' => nil, | |
'Suite' => nil, | |
'City' => 'Rancho Santa Margarita', | |
'State' => 'CA', | |
'PostalCode' => '92688', | |
'Country' => nil, | |
'PhoneNumber' => nil, | |
'EmailAddress' => nil, | |
'FreeForm' => nil, | |
}] | |
}.to_json | |
url = 'http://personator.melissadata.net/v3/WEB/ContactVerify/doContactVerify' | |
JSON.parse(RestClient.post(url, message, content_type: :json, accept: :json)) | |
# => {"Records"=> | |
# [{"AddressExtras"=>" ", | |
# "AddressKey"=>"92688211282", | |
# "AddressLine1"=>"22382 Avenida Empresa", | |
# "AddressLine2"=>" ", | |
# "City"=>"Rancho Santa Margarita", | |
# "CompanyName"=>" ", | |
# "EmailAddress"=>" ", | |
# "NameFull"=>" ", | |
# "PhoneNumber"=>" ", | |
# "PostalCode"=>"92688-2112", | |
# "RecordExtras"=>" ", | |
# "RecordID"=>"1", | |
# "Reserved"=>" ", | |
# "Results"=>"AS01", | |
# "State"=>"CA"}], | |
# "TotalRecords"=>"1", | |
# "TransmissionReference"=>"Sample", | |
# "TransmissionResults"=>" ", | |
# "Version"=>"3.3.6"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment