Introducing our Snowflake Data Cloud Native Application: AI-Driven Data Quality built into SQL statements! Learn More

Street Address Matching API Code Examples



API: Street Address Matching

Register for API Key

Python

This example demonstrates how to make an HTTP GET request using Python's built-in modules.


import urllib.request
import json
import urllib.parse

api_key = 'your-api-key-here'
address = '400 East Broadway St'
algorithm = 'ai-medium-narrow'

url = f'https://api.interzoid.com/getaddressmatchadvanced?license={api_key}&address={urllib.parse.quote(address)}&algorithm={algorithm}'

with urllib.request.urlopen(url) as response:
    data = json.loads(response.read().decode())
    print(data['SimKey'])
        

Node.js

This example shows how to perform an HTTP GET request using Node.js without external libraries.


const https = require('https');

const apiKey = 'your-api-key-here';
const address = '400 East Broadway St';
const algorithm = 'ai-medium-narrow';

const url = `https://api.interzoid.com/getaddressmatchadvanced?license=${apiKey}&address=${encodeURIComponent(address)}&algorithm=${algorithm}`;

https.get(url, (resp) => {
  let data = '';

  resp.on('data', (chunk) => {
    data += chunk;
  });

  resp.on('end', () => {
    const jsonData = JSON.parse(data);
    console.log(jsonData['SimKey']);
  });

}).on("error", (err) => {
  console.log("Error: " + err.message);
});
        

Go

This example uses Go's net/http package to make an HTTP GET request.


package main

import (
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
    "net/url"
)

func main() {
    apiKey := "your-api-key-here"
    address := "400 East Broadway St"
    algorithm := "ai-medium-narrow"

    url := fmt.Sprintf("https://api.interzoid.com/getaddressmatchadvanced?license=%s&address=%s&algorithm=%s",
        apiKey, url.QueryEscape(address), algorithm)

    resp, err := http.Get(url)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)

    var result map[string]interface{}
    json.Unmarshal(body, &result)

    fmt.Println(result["SimKey"])
}
        

Java

This example demonstrates how to make an HTTP GET request using Java's HttpURLConnection.


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import org.json.JSONObject;

public class ApiExample {
    public static void main(String[] args) throws Exception {
        String apiKey = "your-api-key-here";
        String address = "400 East Broadway St";
        String algorithm = "ai-medium-narrow";

        String url = "https://api.interzoid.com/getaddressmatchadvanced?license=" + apiKey +
                     "&address=" + URLEncoder.encode(address, "UTF-8") +
                     "&algorithm=" + algorithm;

        URL obj = new URL(url);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();

        con.setRequestMethod("GET");

        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();

        while ((inputLine = in.readLine()) != null) {
            response.append(inputLine);
        }
        in.close();

        JSONObject jsonObj = new JSONObject(response.toString());
        System.out.println(jsonObj.getString("SimKey"));
    }
}
        

TypeScript

This example uses TypeScript with Node's https module to make an HTTP GET request.


import * as https from 'https';

const apiKey = 'your-api-key-here';
const address = '400 East Broadway St';
const algorithm = 'ai-medium-narrow';

const url = `https://api.interzoid.com/getaddressmatchadvanced?license=${apiKey}&address=${encodeURIComponent(address)}&algorithm=${algorithm}`;

https.get(url, (resp) => {
  let data = '';

  resp.on('data', (chunk: string) => {
    data += chunk;
  });

  resp.on('end', () => {
    const jsonData = JSON.parse(data);
    console.log(jsonData['SimKey']);
  });

}).on("error", (err: Error) => {
  console.log("Error: " + err.message);
});
        

Rust

This example uses Rust's standard library to make an HTTP GET request.


use std::io::Read;
use std::net::TcpStream;
use std::str;
use url::form_urlencoded;

fn main() {
    let api_key = "your-api-key-here";
    let address = "400 East Broadway St";
    let algorithm = "ai-medium-narrow";

    let encoded_address: String = form_urlencoded::Serializer::new(String::new())
        .append_pair("address", address)
        .finish();

    let url = format!("https://api.interzoid.com/getaddressmatchadvanced?license={}&address={}&algorithm={}",
                      api_key, encoded_address, algorithm);

    let mut resp = reqwest::blocking::get(&url).unwrap();
    let mut body = String::new();
    resp.read_to_string(&mut body).unwrap();

    let json: serde_json::Value = serde_json::from_str(&body).unwrap();
    println!("{}", json["SimKey"]);
}
        

C#

This example uses C#'s HttpClient class to make an HTTP GET request.


using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using Newtonsoft.Json.Linq;

namespace ApiExample
{
    class Program
    {
        static async Task Main(string[] args)
        {
            string apiKey = "your-api-key-here";
            string address = "400 East Broadway St";
            string algorithm = "ai-medium-narrow";

            string url = $"https://api.interzoid.com/getaddressmatchadvanced?license={apiKey}&address={HttpUtility.UrlEncode(address)}&algorithm={algorithm}";

            HttpClient client = new HttpClient();
            var response = await client.GetStringAsync(url);

            var json = JObject.Parse(response);
            Console.WriteLine(json["SimKey"]);
        }
    }
}
        

R

This example uses R's built-in functions to make an HTTP GET request.


api_key <- 'your-api-key-here'
address <- '400 East Broadway St'
algorithm <- 'ai-medium-narrow'

url <- paste0('https://api.interzoid.com/getaddressmatchadvanced?license=', api_key,
              '&address=', URLencode(address), '&algorithm=', algorithm)

response <- readLines(url, warn = FALSE)
data <- jsonlite::fromJSON(response)
print(data$SimKey)
        

Scala

This example uses Scala's standard library to make an HTTP GET request.


import scala.io.Source
import play.api.libs.json._
import java.net.URLEncoder

object ApiExample {
  def main(args: Array[String]): Unit = {
    val apiKey = "your-api-key-here"
    val address = "400 East Broadway St"
    val algorithm = "ai-medium-narrow"

    val encodedAddress = URLEncoder.encode(address, "UTF-8")
    val url = s"https://api.interzoid.com/getaddressmatchadvanced?license=$apiKey&address=$encodedAddress&algorithm=$algorithm"

    val response = Source.fromURL(url).mkString
    val json = Json.parse(response)
    println((json \ "SimKey").as[String])
  }
}