Search for a Verify Request

You can use the search functionality to see the current status or eventual outcome of a Verify request, using the request_id returned when the verify code was sent.

Replace the following variables in the sample code with your own values:

Name Description
NEXMO_API_KEY Your Nexmo API key
NEXMO_API_SECRET Your Nexmo API secret
REQUEST_ID The ID of the Verify request you wish to cancel (this is returned in the API response when you send a verification code)

Write the code

Add the following to search-for-verify-request.sh:

Copy to Clipboard
curl -X GET "https://api.nexmo.com/verify/search/json?&api_key=$NEXMO_API_KEY&api_secret=$NEXMO_API_SECRET&request_id=$REQUEST_ID"

View full source

Run your code

Save this file to your machine and run it:

sh search-for-verify-request.sh

Prerequisites

Install dependencies

Install-Package Nexmo.Csharp.Client
Initialize your dependencies

Create a file named VerifyController.cs and add the following code:

Copy to Clipboard
public class BasicAuth
{
    public BasicAuth()
    {
        var client = new Client(creds: new Nexmo.Api.Request.Credentials

View full source

Write the code

Add the following to VerifyController.cs:

Copy to Clipboard
var search = Client.NumberVerify.Search(new NumberVerify.SearchRequest
{
    request_id = requestID
});

View full source

Prerequisites

Install dependencies

gem install nexmo
Initialize your dependencies

Create a file named search.rb and add the following code:

Copy to Clipboard
require 'nexmo'

client = Nexmo::Client.new(
  api_key: NEXMO_API_KEY,
  api_secret: NEXMO_API_SECRET
)

View full source

Write the code

Add the following to search.rb:

Copy to Clipboard
response = client.verify.search(request_id: REQUEST_ID)

if !response.error_text
  # The current status of this request, for example:
  # => IN PROGRESS
  puts response.status
else
  puts response.error_text
end

View full source

Run your code

Save this file to your machine and run it:

ruby search.rb