This example demonstrates how to make an HTTP GET request using Python's built-in modules.
import urllib.request
import json
api_key = 'your-api-key-here'
fullname = 'James Johnston'
url = f'https://api.interzoid.com/getfullnamematch?license={api_key}&fullname={fullname}'
with urllib.request.urlopen(url) as response:
data = json.loads(response.read().decode())
print(data['SimKey'])
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 fullname = 'James Johnston';
const url = `https://api.interzoid.com/getfullnamematch?license=${apiKey}&fullname=${encodeURIComponent(fullname)}`;
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);
});
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"
fullname := "James Johnston"
url := fmt.Sprintf("https://api.interzoid.com/getfullnamematch?license=%s&fullname=%s", apiKey, url.QueryEscape(fullname))
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"])
}
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 fullname = "James Johnston";
String url = "https://api.interzoid.com/getfullnamematch?license=" + apiKey + "&fullname=" + URLEncoder.encode(fullname, "UTF-8");
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"));
}
}
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 fullname = 'James Johnston';
const url = `https://api.interzoid.com/getfullnamematch?license=${apiKey}&fullname=${encodeURIComponent(fullname)}`;
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);
});
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 fullname = "James Johnston";
let encoded_fullname: String = form_urlencoded::Serializer::new(String::new())
.append_pair("fullname", fullname)
.finish();
let url = format!("https://api.interzoid.com/getfullnamematch?license={}&fullname={}", api_key, encoded_fullname);
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"]);
}
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 fullname = "James Johnston";
string url = $"https://api.interzoid.com/getfullnamematch?license={apiKey}&fullname={HttpUtility.UrlEncode(fullname)}";
HttpClient client = new HttpClient();
var response = await client.GetStringAsync(url);
var json = JObject.Parse(response);
Console.WriteLine(json["SimKey"]);
}
}
}
This example uses R's built-in functions to make an HTTP GET request.
api_key <- 'your-api-key-here'
fullname <- 'James Johnston'
url <- paste0('https://api.interzoid.com/getfullnamematch?license=', api_key, '&fullname=', URLencode(fullname))
response <- readLines(url, warn = FALSE)
data <- jsonlite::fromJSON(response)
print(data$SimKey)
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 fullname = "James Johnston"
val encodedFullname = URLEncoder.encode(fullname, "UTF-8")
val url = s"https://api.interzoid.com/getfullnamematch?license=$apiKey&fullname=$encodedFullname"
val response = Source.fromURL(url).mkString
val json = Json.parse(response)
println((json \ "SimKey").as[String])
}
}