MySafeInfo Code Library

We offer sample code for the most requested programming languages. Unfortunately we cannot offer all programming languages requested; however, if you need additional assistance, please contact us and we may be able to point you in the right direction, or provide custom development at an additional fee.

Data API Quick Links
WICK API Quick Links

Retrieving presidents in JSON (HTML, JavaScript, AngularJS)

Retrieving presidents in JSON (HTML, JavaScript, jQuery, Knockout)

Retrieving The Beatles' albums in JSON (HTML, JavaScript)

Retrieving presidents in XML (HTML, JavaScript, jQuery)

Populating presidents dropdown in XML (HTML, JavaScript, jQuery)

Retrieving presidents in JSONP (HTML, JavaScript, jQuery)

Populating states dropdown in JSONP (HTML, JavaScript, jQuery)

Retrieving presidents in TABLE (HTML, JavaScript, jQuery)

Retrieving presidents in SELECT (HTML, JavaScript, jQuery)

Retrieving presidents in RADIO (HTML, JavaScript, jQuery)

Retrieving presidents in CHECKBOX (HTML, JavaScript, jQuery)

Retrieving states in XML (C#)

// variables
XmlDocument States = new XmlDocument();
string Url = ",abbreviation=code,statehood=year&exclude=id&token=test";

// request

// iterate states collection
foreach (XmlElement s in States.SelectNodes("//s"))
    Console.WriteLine(string.Format("{0}, {1}, {2}, {3}", s.GetAttribute("name"), s.GetAttribute("code"), s.GetAttribute("capital"), s.GetAttribute("year")));

Retrieving states in XML (VB.Net)

Dim States As New XmlDocument()
Dim Url As String = ",abbreviation=code,statehood=year&exclude=id&token=test"


'iterate states collection
For Each s As XmlElement In States.SelectNodes("//s")
    Console.WriteLine(String.Format("{0}, {1}, {2}, {3}", s.GetAttribute("name"), s.GetAttribute("code"), s.GetAttribute("capital"), s.GetAttribute("year")))

Retrieving states in JSON (C#)

// variables
string Result = string.Empty;
string Url = ",abbreviation=code,statehood=year&exclude=id&token=test";
List<State> States = new List<State>();

// request
using (WebClient client = new WebClient())
    // specify encoding
    client.Encoding = System.Text.UTF8Encoding.UTF8;

    // download data
    Result = client.DownloadString(Url);

// use Json.NET (Newtonsoft.Json) to deserialize json string into a strongly typed list of states
States = Newtonsoft.Json.JsonConvert.DeserializeObject<List<State>>(Result);

// iterate states collection
foreach (State s in States)
    Console.WriteLine(string.Format("{0}, {1}, {2}, {3}",, s.code,, s.year));

// state class
public class State
    public string name = string.Empty;
    public string code = string.Empty;
    public string capital = string.Empty;
    public string year = string.Empty;

Retrieving presidents in CSV (Java)

public class ReadCSV {
    // url to web service
    final static String webSiteURL = "";

    // outfile file path
    final static String rawFileName = "c:\\temp\\presidents.csv";

    // main
    public static void main(String[] args) {
        // fetch our data and create a CSV file

    // fetch data from web in CSV format
    private static void fetchData(String siteURL) {
        try {
            // open output file
            PrintWriter pw =  new PrintWriter(rawFileName);

            // define URL using website address
            URL serviceURL = new URL(siteURL);

            // define an input stream and reader
            InputStream is = serviceURL.openStream();
            InputStreamReader isr = new InputStreamReader(is, "UTF-8");

            // buffered reader let us read and process chunks of data at time
            BufferedReader br = new BufferedReader(isr);

            // create a variable to hold the contents from the buffer
            StringBuffer response = new StringBuffer();

            // fetch the next chunk of content
            String nextLineFromService = br.readLine();

            // keep reading and appending to the buffer
            while (nextLineFromService != null) {
                // to see what we are doing in the console

                // output line to file
                nextLineFromService = br.readLine();

            // dump the buffer to our content variable
        catch (Exception e) {