Go Sample Code: Global Telephone Data

Here is an example that will retrieve local enrichment data for an international phone number.

Go code:

            
package main

import (
    "encoding/json"
    "fmt"
    "net/http"
)

type Payload struct {
    Country     string
    Region      string
    PrimaryCity string
    Language1   string
    Language2   string
    Language3   string
    Mobile      string
    Wealth      string
    Code        string
}

func main() {
    // Create the struct variable to store the decoded JSON response
    thePayload := Payload{}

    // Call the API
    response, _ := http.Get("https://api.interzoid.com/getglobalnumberinfo?license=
                YOURAPILICENSEKEY&intlnumber=+4906979550")

    if response.StatusCode != 200 {
        // Report any HTTP Errors
        fmt.Println("Error: ", response.Status)

    } else {
        // Decode the JSON and print a comma-delimited response,
        // one of many ways to format the response
        _ = json.NewDecoder(response.Body).Decode(&thePayload)

        fmt.Println(
        thePayload.Country + "," +
        thePayload.Region + "," +
        thePayload.PrimaryCity + "," +
        thePayload.Language1 + "," +
        thePayload.Language2 + "," +
        thePayload.Language3 + "," +
        thePayload.Mobile + "," +
        thePayload.Wealth +
        "\r\n")
    }
}
            

To execute from the command line:

            
> go run YOURFILENAME.go
            

Results:

            
Germany,Hesse,Frankfurt,German,,,,1
            

If you do not have an API License Key, you can obtain one by registering here.

Return to Get Global Number Information API page

Free API Credits
Register for an Interzoid API account and receive free trial credits
Company Name Matching API
Generate similarity keys to identify duplicate and inconsistent company name data
More Info...
Other Matching APIs
Generate similarity keys for other data types
More Info...
International Phone Demographics API
Test page load and other Web asset performance time with a simple API call
More Info...
Email Information API
Get email address validation and enhancement data
More Info...