Sample Code

1. Bulk Correction In C#

In C# bulk Correction API can be accessed by using following Code:

Code Sample

using System;
using System.IO;
using System.Net;
using System.Text;
class MainClass
{
    public static void Main (string[] args)
    {
        String Request ="{\"address\":[[\"Case1\",\"564 HELIGAN LN #1q\",\"\",\"LIVERMORE\",\"CA\",\"94551\"]],\"count\":\"1\",\"jobs\":\"1\", \"data\":\"USPS\",\"log\":\"Enable\"}";
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.fixaddress.com/SACAPI/bulkFromCode");
        request.ContentType = "application/x-www-form-urlencoded";
        request.Method = "POST";
        byte[] byteArray = Encoding.UTF8.GetBytes(Request);
        request.ContentLength = byteArray.Length;
        Stream dataStream = request.GetRequestStream();
        dataStream.Write(byteArray, 0, byteArray.Length);
        WebResponse response = request.GetResponse();
        dataStream = response.GetResponseStream();
        StreamReader reader = new StreamReader(dataStream);
        string Response = reader.ReadToEnd();
        Console.WriteLine (Response);
        dataStream.Close();
        Console.ReadLine();
    }
}

2. Bulk Correction In Java

In Java bulk Correction API can be accessed by using following Code:

Code Sample

import java.net.*;
import java.io.*;
public class Test {
    public static void main(String[] args) throws MalformedURLException,IOException
    {
        String data = "{\"address\":[[\"Case1\",\"564 HELIGAN LN #1q\",\"\",\"LIVERMORE\",\"CA\",\"94551\"]],\"count\":\"1\",\"jobs\":\"1\", \"data\":\"USPS\",\"log\":\"Enable\"}";
        byte[] bytesData = data.getBytes();
        URL url = new URL("https://www.fixaddress.com/SACAPI/bulkFromCode");
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setDoOutput(true);
        conn.setReadTimeout(60000);
        conn.setRequestProperty("Content-Type", "application/octet-stream");
        conn.setRequestProperty("data", data);
        OutputStream out = conn.getOutputStream();
        out.write(bytesData);
        out.flush();
        BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String output;
        while ((output = br.readLine()) != null) {
            System.out.println(output);
        }
    }
}

3. Bulk Correction In Python

In Python bulk Correction API can be accessed by using following Code:

Code Sample

import json
import urllib.request
import urllib
from urllib.parse import urlencode
from urllib.request import Request, urlopen
url = "https://www.fixaddress.com/SACAPI/bulkFromCode";
data = "{'address':[['Case1','564 HELIGAN LN #1q','','LIVERMORE','CA','94551']],'count':'1','jobs':'1','data':'USPS','log':'Enable'}"
request = Request(url, data.encode())
res = urlopen(request).read().decode()
print(res)

4. Bulk Correction In Ruby

In Ruby bulk Correction API can be accessed by using following Code:

Code Sample

require 'net/http'
require 'json'
uri =URI('http://fixaddress.com/SACAPI/bulkFromCode')
req =Net::HTTP::Post.new(uri, initheader = {'Content-Type'=>'application/json'})
req.body = {'address':[['Case1','564 HELIGAN LN #1q','','LIVERMORE','CA','94551']],'count':'1','jobs':'1', 'data':'USPS','log':'Enable'}.to_json
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
res = http.request(req)
puts res.body
end