GRT API Version 1.3

Query by Address

GET /api/by_address

Query Parameters

Parameter Description:Example In Address Example Type Example
street_number Street Number: 1 N Mansion Dr NW Santa Fe NM 87501 interger 1
pre_direction Pre Direction: 1 N Mansion Dr NW Santa Fe NM 87501 string N
street_name Street Name: 1 N Mansion Dr NW Santa Fe NM 87501 string Mansion
street_suffix Street Suffix: 1 N Mansion Dr NW Santa Fe NM 87501 string Dr
street_post_directional Street Post Directional 1 N Mansion Dr NW Santa Fe NM 87501 string NW
city City 1 N Mansion Dr NW Santa Fe NM 87501 string Santa Fe
zipcode 5 Digit Zip Code 1 N Mansion Dr NW Santa Fe NM 87501 interger 87501

Examples:

Missing elements can be set to empty string as pre_direction and street_post_directional below:

/api/by_address?street_number=1&pre_direction=&street_name=Mansion&street_suffix=Dr&street_post_directional=&city=Santa%20Fe&zipcode=87501

Missing elements can also be omitted.

/api/by_address?street_number=1&street_name=Mansion&street_suffix=Dr&city=Santa%20Fe&zipcode=87501

PO Box lookups can be done by using "PO BOX" as the street_name and the box number as the street_number

api/by_address?street_number=65432&street_name=PO BOX&city=Albuquerque&zipcode=87193

Response

JSON

Return Address for Thai Vegan

/api/by_address?street_number=3804&street_name=Central&street_suffix=Ave&street_post_directional=SE&city=Albuquerque&zipcode=87108

Expected Response

                        
{
    "results": [
    {
    "street_number": "3804",
    "street_name": "Central",
    "street_suffix": "Ave",
    "street_post_directional": "SE",
    "city": "Albuquerque",
    "zipcode": "87108",
    "tax_rate": 7.875,
    "success": true,
    "county": "Bernalillo"
    }
    ]
}
                        
                        

POST /api/by_address

JSON Key Values

Key Description Type Value Example
street_number Street Number interger 1
pre_direction Pre Direction string N
street_name Street Name string Mansion
street_suffix Street Suffix string Dr
street_post_directional Street Post Directional string NW
city City string Santa Fe
zipcode Zip Code interger 87501

Examples:

JSON POST Data Example:
                    
                        {
                            "addresses": [
                              {
                                "city": "Santa Fe", 
                                "county": "Santa Fe", 
                                "street_name": "Mansion", 
                                "street_number": "1", 
                                "street_suffix": "Dr", 
                                "zipcode": "87501"
                              }, 
                              {
                                "city": "Albuquerque", 
                                "county": "Bernalillo", 
                                "street_name": "Central", 
                                "street_number": "3804", 
                                "street_post_directional": "SE", 
                                "street_suffix": "Ave", 
                                "zipcode": "87108"
                              }
                            ]
                          }
                    
                    
Code Examples
Javascript Fetch Logo
Javascript Jquery Logo
Python Logo
PHP Logo

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
    "addresses": [
    {
        "street_number": "1",
        "street_name": "Mansion",
        "street_suffix": "Dr",
        "city": "Santa Fe",
        "zipcode": "87501",
        "county": "Santa Fe"
    },
    {
        "street_number": "3804",
        "street_name": "Central",
        "street_suffix": "Ave",
        "city": "Albuquerque",
        "zipcode": "87108",
        "county": "Bernalillo",
        "street_post_directional": "SE"
    }
    ]
});

var requestOptions = {
    method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};

fetch("https://grt.edacnm.org/api/by_address", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));
                      

Expected Response

                              
{
    "results": [
        {
            "street_number": "1",
            "street_name": "Mansion",
            "street_suffix": "Dr",
            "city": "Santa Fe",
            "zipcode": "87501",
            "county": "Santa Fe",
            "tax_rate": 8.4375,
            "success": true
        },
        {
            "street_number": "3804",
            "street_name": "Central",
            "street_suffix": "Ave",
            "city": "Albuquerque",
            "zipcode": "87108",
            "county": "Bernalillo",
            "street_post_directional": "SE",
            "tax_rate": 7.875,
            "success": true
        }
    ]
}
                              
                              
Query by File Upload

GET /api/upload

Response

                
                    <h1>Upload xls or xlsx file</h1>
                    <form action="https://grt.edacnm.org//api/upload" method=post enctype=multipart/form-data>
                      <input type=file name=file>
                      <input type=submit value=Upload>
                    </form>
                
            

Example Upload File:

DOWNLOAD EXAMPLE TEMPLATE

Example HTML response:

Upload xls or xlsx file

POST /api/upload

Response

Binary File

Code Example

Python Example:

                

import requests

url = "https://grt.edacnm.org/api/upload"

payload = {}
files = [
    ('file', ('example.xlsx', open('/home/admin/examples/example.xlsx', 'rb'),
        'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'))
]
headers = {}
local_filename = "/home/admin/examples/testdl.xls"
response = requests.request(
    "POST", url, headers=headers, data=payload, files=files)
response.raise_for_status()
with open(local_filename, 'wb') as f:
    for chunk in response.iter_content(chunk_size=8192):
        f.write(chunk)
print(local_filename + " created.")