Example

    Look up a number for the carrier information.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    
    import plivo
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    
    #Number lookup API
    response = client.lookup.get("<your_number>")
    
    print(response)
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    # Numberlookup API
    begin
    response = api.lookup.get('your_number')
    puts response
    rescue PlivoRESTError => e
        puts 'Exception: ' + e.message
    end
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    
    // Numberlookup
    client.lookup.get("<your_number>")
    .then(function(response) {
        console.log(response);
    }).catch(function(error) {
        console.log(error);
    });
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    
    $client->client->setTimeout(40);
    
    
    // Numberlookup API Product
    try { 
    $response = $client->lookup->get("<your_number>");
    print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r(ex);
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    package test;
    import java.io.IOException;
    import com.plivo.api.exceptions.PlivoRestException;
    public class Test {
    	public static void main(String[] args) {
    		Plivo.init("auth_id", "auth_token");
            //Number Lookup API
    		try {
    				System.out.println(com.plivo.api.models.lookup.Number
    			        .getter("<your_number>")
    			        .get());
    		} catch (IOException e) {
    				e.printStackTrace();
    		} catch (PlivoRestException e) {
    				e.printStackTrace();
    		}
    	}
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace test_apps
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("auth_id","auth_token");
    
                // Number Look Up API
                try
                {
                    var response = api.Lookup.Get("your_number");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    
    1
    2
    
    curl -i --user auth_id:auth_token \
    https://lookup.plivo.com/v1/Number/{PhoneNumber}?type=carrier
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    
    package main
    
    import (
    	"fmt"
    
    	plivo "github.com/plivo/plivo-go"
    )
    
    func main() {
    
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>",
    		&plivo.ClientOptions{})
    	if err != nil {
    			fmt.Print("Error", err.Error())
    			return
    		}
    
    	// Numberlookup
    	response, err := client.Lookup.Get("<your_number>",
    		plivo.LookupParams{})
    	if err != nil {
    			fmt.Print("Error", err.Error())
    			return
    		}
    	fmt.Printf("Response: %#v\n", response)
    }