This code showcases the Melissa Phone Object using C#.
Please feel free to copy or embed this code to your own project. Happy coding!
For the latest Melissa Phone Object release notes, please visit: https://releasenotes.melissa.com/on-premise-api/phone-object/
For further details, please visit: https://docs.melissa.com/on-premise-api/phone-object/phone-object-quickstart.html
The console will ask the user for:
- Phone
And return
- Area Code
- Phone Prefix
- Phone Suffix
- City
- State
- Latitude
- Longitude
- Time Zone
- Result Codes
- Linux 64-bit .NET 7.0, Ubuntu 20.04.05 LTS
- Melissa data files for 2024-04
This is the code of the Melissa Object.
- mdGlobalPhone.dat
- mdPhone.dat
- mdPhone.idx
- mdAddr.dat
- ZIPNPA.TXT
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Before starting, check to see if you already have the .NET 7.0 SDK already installed by entering this command:
dotnet --list-sdks
If the .NET 7.0 SDK is already installed, you should see it in the following list:
As long as the above list contains version 7.0.xxx
(underlined in red), then you can skip to the next step. If your list does not contain version 7.0, or you get any kind of error message, then you will need to download and install the .NET 7.0 SDK.
To download, run the following commands to add the Microsoft package signing key to your list of trusted keys and add the package repository.
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
Next, you can now run this command to install the .NET 7.0 SDK:
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-7.0
Once all of this is done, you should be able to verify that the SDK is installed with the dotnet --list-sdks
command.
$ git clone https://github.com/MelissaData/PhoneObject-Dotnet-Linux
$ cd PhoneObject-Dotnet-Linux
Melissa Updater is a CLI application allowing the user to update their Melissa applications/data.
-
In the root directory of the project, create a folder called
MelissaUpdater
by using the command:mkdir MelissaUpdater
-
Enter the newly created folder using the command:
cd MelissaUpdater
-
Proceed to install the Melissa Updater using the curl command:
curl -L -O https://releases.melissadata.net/Download/Library/LINUX/NET/ANY/latest/MelissaUpdater
-
After the Melissa Updater is installed, you will need to change the Melissa Updater to an executable using the command:
chmod +x MelissaUpdater
-
Now that the Melissa Updater is set up, you can now proceed to move back into the project folder by using the command:
cd ..
- Using Melissa Updater
- It will handle all of the data download/path and .so file(s) for you.
- If you already have the latest DQS release zip, you can find the data file(s) in there
- To pass in your own data file path directory, you may either use the '--dataPath' parameter or enter the data file path directly in interactive mode.
- Comment out this line "DownloadDataFiles $license" in the bash script.
- This will prevent you from having to redownload all the files.
To be able to run the bash script, you must first make it an executable using the command:
chmod +x MelissaPhoneObjectLinuxDotnet.sh
As an indicator, the filename will change colors once it becomes an executable.
Parameters:
-
--phone: a test phone number
This is convenient when you want to get results for a specific phone number in one run instead of testing multiple phone numbers in interactive mode.
-
--dataPath (optional): a data file path directory to test the Phone Object
-
--license (optional): a license string to test the Phone Object
-
--quiet (optional): add to the command if you do not want to get any console output from the Melissa Updater
When you have modified the script to match your data location, let's run the script. There are two modes:
-
Interactive
The script will prompt the user for a phone number, then use the provided number to test Phone Object. For example:
$ ./MelissaPhoneObjectLinuxDotnet.sh
For quiet mode:
$ ./MelissaPhoneObjectLinuxDotnet.sh --quiet
-
Command Line
You can pass a phone number in
--phone
parameter and a license string in--license
parameter to test Phone Object. For example:$ ./MelissaPhoneObjectLinuxDotnet.sh --phone "800-635-4772" $ ./MelissaPhoneObjectLinuxDotnet.sh --phone "800-635-4772" --license "<your_license_string>"
For quiet mode:
$ ./MelissaPhoneObjectLinuxDotnet.sh --phone "800-635-4772" --quiet $ ./MelissaPhoneObjectLinuxDotnet.sh --phone "800-635-4772" --license "<your_license_string>" --quiet
This is the expected output from a successful setup for interactive mode:
Troubleshooting for errors found while running your program.
Error | Description |
---|---|
ErrorRequiredFileNotFound | Program is missing a required file. Please check your Data folder and refer to the list of required files above. If you are unable to obtain all required files through the Melissa Updater, please contact technical support below. |
ErrorLicenseExpired | Expired license string. Please contact technical support below. |
For free technical support, please call us at 800-MELISSA ext. 4 (800-635-4772 ext. 4) or email us at tech@melissa.com.
To purchase this product, contact the Melissa sales department at 800-MELISSA ext. 3 (800-635-4772 ext. 3).