How to Get Basic Number Insights Within an ASP.NET App

Published May 22, 2018 by Rabeb Othmani

This is the second article in this step-by-step series about Nexmo’s Number Insight API within an ASP.NET web application.

In the first article, we walked through everything we need to know about the Number Insight API, setting up the ASP.NET application and getting ready to explore how to get insights about a phone number.

In this article, we will continue from where we left off in the first article for a deep dive into Number Insight Basic API. We will use the API to retrieve some basic information about a phone number such as its international and national formats and the country where the number is registered and then present it to the user.

Number Insight Basic API is a free synchronous, easy-to-use RESTful web service. For any phone number you can:

  • Retrieve the international and local format.
  • Know the country where the number is registered.

Hands-on code

In NumberInsightController.cs, let’s start by creating the method that would allow the navigation to the basic insights view.

We will now add that view entitled Basic.cshtml under the NumberInsight views folder.

This view will serve as a placeholder for the user to input a phone number.

In order to get some basic insights about that phone number, we will add another method to ‘NumberInsightController.cs’ with a string parameter representing the phone number and make a call to Number Insight Basic API.

Notice that after fetching the insights, we need to show them to the user.
We are going to create a BasicResults method in the controller and a BasicResults.cshtml view for that matter.

Now, let’s run the app and make a call to Number Insight Basic API.
You can use one of the Nexmo numbers provided for testing.



Recap

In this article, we learnt how to use Nexmo’s Number Insight Basic API to retrieve the international and national formats of a phone number and the country where the number is registered. Then we showed this information on a view within an ASP.NET application.
In the next article of the series, we will learn how to get Standard Number Insights within an ASP.NET app. Stay tuned!

Nexmo Number Insight getting started guide for ASP.NET

Leave a Reply

Your email address will not be published.