Road Closed

This information is outdated and is no longer maintained. Get the latest!

 

REST+JSON Doc Clarification for Multiple Responses?

Question

Last Updated: March 18, 2013

I'm looking at using the SmartyStreets REST+JSON API from a non-browser client. The docs have given me what I need to complete my analysis except for one small issue. In section 4 of the REST+JSON doc a "candidates" input parameter is allowed to specify the maximum number of matches desired in the case of an ambiguous response. However, the JSON Responses section of the doc only shows the cases of an empty response and a single response.

So my questions are: (1) Are multiple responses supported in the REST+JSON API, and if so (2) what does the JSON output look like for the multiple response case?

Thanks!

Answer

Given this input:

"street": "5 rosedale"
"city": "baltimore"
"state": "md"
"zipcode": "21229"

The output is an arrangement of JSON objects that has the expected address fields and analysis. Notice that the candidate id increments with each item in the response array:

[
    {
        "input_index": 0,
        "candidate_index": 0,
        "delivery_line_1": "5 N Rosedale St",
        "last_line": "Baltimore MD 21229-3737",
        "delivery_point_barcode": "212293737059",
        "components": {
            "primary_number": "5",
            "street_predirection": "N",
            "street_name": "Rosedale",
            "street_suffix": "St",
            "city_name": "Baltimore",
            "state_abbreviation": "MD",
            "zipcode": "21229",
            "plus4_code": "3737",
            "delivery_point": "05",
            "delivery_point_check_digit": "9"
        },
        "metadata": {
            "record_type": "S",
            "zip_type": "Standard",
            "county_fips": "24510",
            "county_name": "Baltimore City",
            "carrier_route": "C047",
            "congressional_district": "07",
            "rdi": "Residential",
            "elot_sequence": "0059",
            "elot_sort": "A",
            "latitude": 39.28661,
            "longitude": -76.66901,
            "precision": "Zip9"
        },
        "analysis": {
            "dpv_match_code": "Y",
            "dpv_footnotes": "AABB",
            "dpv_cmra": "N",
            "dpv_vacant": "N",
            "active": "Y"
        }
    },
    {
        "input_index": 0,
        "candidate_index": 1,
        "delivery_line_1": "5 S Rosedale St",
        "last_line": "Baltimore MD 21229-3739",
        "delivery_point_barcode": "212293739057",
        "components": {
            "primary_number": "5",
            "street_predirection": "S",
            "street_name": "Rosedale",
            "street_suffix": "St",
            "city_name": "Baltimore",
            "state_abbreviation": "MD",
            "zipcode": "21229",
            "plus4_code": "3739",
            "delivery_point": "05",
            "delivery_point_check_digit": "7"
        },
        "metadata": {
            "record_type": "S",
            "zip_type": "Standard",
            "county_fips": "24510",
            "county_name": "Baltimore City",
            "carrier_route": "C047",
            "congressional_district": "07",
            "rdi": "Residential",
            "elot_sequence": "0064",
            "elot_sort": "A",
            "latitude": 39.28543,
            "longitude": -76.66896,
            "precision": "Zip9"
        },
        "analysis": {
            "dpv_match_code": "Y",
            "dpv_footnotes": "AABB",
            "dpv_cmra": "N",
            "dpv_vacant": "N",
            "active": "Y"
        }
    }
]

]

You can try out other addresses and see the results on the REST API management page.