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 suggestions desired in the 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!

asked 21 Feb, 11:58

Brett's gravatar image

Brett
112
accept rate: 0%

edited 03 Apr, 15:55

Jeffrey%20-%20SmartyStreets's gravatar image

Jeffrey - SmartyStreets ♦♦
2.2k14


Yes, multiple responses are supported in the REST+JSON API. I have modified the JSON Responses section of the doc to show an example of multiple responses.

link

answered 21 Feb, 12:32

Jeffrey%20-%20SmartyStreets's gravatar image

Jeffrey - SmartyStreets ♦♦
2.2k14
accept rate: 50%

edited 03 Apr, 15:55

Given this input:

Street: university ave
City: provo
State: ut
ZIP Code: 84604

The output is an array of JSON objects that each have 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,
        "addressee": "Centaur",
        "delivery_line_1": "N University Ave",
        "last_line": "Provo UT 84604-5699",
        "delivery_point_barcode": "846045699991",
        "components": {
            "street_predirection": "N",
            "street_name": "University",
            "street_suffix": "Ave",
            "city_name": "Provo",
            "state_abbreviation": "UT",
            "zipcode": "84604",
            "plus4_code": "5699",
            "delivery_point": "99",
            "delivery_point_check_digit": "1"
        },
        "metadata": {
            "record_type": "F",
            "county_fips": "49049",
            "county_name": "Utah",
            "carrier_route": "R003",
            "congressional_district": "03"
        },
        "analysis": {
            "dpv_match_code": "Y",
            "dpv_footnotes": "AABBM1",
            "dpv_cmra": "N",
            "dpv_vacant": "N",
            "ews_match": false
        }
    },
    {
        "input_index": 0,
        "candidate_index": 1,
        "delivery_line_1": "811 N University Ave",
        "last_line": "Provo UT 84604-3417",
        "delivery_point_barcode": "846043417111",
        "components": {
            "primary_number": "811",
            "street_predirection": "N",
            "street_name": "University",
            "street_suffix": "Ave",
            "city_name": "Provo",
            "state_abbreviation": "UT",
            "zipcode": "84604",
            "plus4_code": "3417",
            "delivery_point": "11",
            "delivery_point_check_digit": "1"
        },
        "metadata": {
            "record_type": "S",
            "county_fips": "49049",
            "county_name": "Utah",
            "carrier_route": "C018",
            "congressional_district": "03",
            "building_default_indicator": "Y"
        },
        "analysis": {
            "dpv_match_code": "D",
            "dpv_footnotes": "AAN1",
            "dpv_cmra": "N",
            "dpv_vacant": "N",
            "ews_match": false,
            "footnotes": "H#"
        }
    },
    {
        "input_index": 0,
        "candidate_index": 2,
        "delivery_line_1": "836 N University Ave",
        "last_line": "Provo UT 84604-6509",
        "delivery_point_barcode": "846046509990",
        "components": {
            "primary_number": "836",
            "street_predirection": "N",
            "street_name": "University",
            "street_suffix": "Ave",
            "city_name": "Provo",
            "state_abbreviation": "UT",
            "zipcode": "84604",
            "plus4_code": "6509",
            "delivery_point": "99",
            "delivery_point_check_digit": "0"
        },
        "metadata": {
            "record_type": "H",
            "county_fips": "49049",
            "county_name": "Utah",
            "carrier_route": "C018",
            "congressional_district": "03",
            "building_default_indicator": "Y"
        },
        "analysis": {
            "dpv_match_code": "D",
            "dpv_footnotes": "AAN1",
            "dpv_cmra": "N",
            "dpv_vacant": "N",
            "ews_match": false,
            "footnotes": "H#"
        }
    },
    {
        "input_index": 0,
        "candidate_index": 3,
        "delivery_line_1": "850 N University Ave",
        "last_line": "Provo UT 84604-3496",
        "delivery_point_barcode": "846043496998",
        "components": {
            "primary_number": "850",
            "street_predirection": "N",
            "street_name": "University",
            "street_suffix": "Ave",
            "city_name": "Provo",
            "state_abbreviation": "UT",
            "zipcode": "84604",
            "plus4_code": "3496",
            "delivery_point": "99",
            "delivery_point_check_digit": "8"
        },
        "metadata": {
            "record_type": "H",
            "county_fips": "49049",
            "county_name": "Utah",
            "carrier_route": "C018",
            "congressional_district": "03",
            "building_default_indicator": "Y"
        },
        "analysis": {
            "dpv_match_code": "D",
            "dpv_footnotes": "AAN1",
            "dpv_cmra": "N",
            "dpv_vacant": "N",
            "ews_match": false,
            "footnotes": "H#"
        }
    },
    {
        "input_index": 0,
        "candidate_index": 4,
        "delivery_line_1": "872 N University Ave",
        "last_line": "Provo UT 84604-3495",
        "delivery_point_barcode": "846043495999",
        "components": {
            "primary_number": "872",
            "street_predirection": "N",
            "street_name": "University",
            "street_suffix": "Ave",
            "city_name": "Provo",
            "state_abbreviation": "UT",
            "zipcode": "84604",
            "plus4_code": "3495",
            "delivery_point": "99",
            "delivery_point_check_digit": "9"
        },
        "metadata": {
            "record_type": "H",
            "county_fips": "49049",
            "county_name": "Utah",
            "carrier_route": "C018",
            "congressional_district": "03",
            "building_default_indicator": "Y"
        },
        "analysis": {
            "dpv_match_code": "D",
            "dpv_footnotes": "AAN1",
            "dpv_cmra": "N",
            "dpv_vacant": "N",
            "ews_match": false,
            "footnotes": "H#"
        }
    },
// etc...

]

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

link

answered 21 Feb, 12:32

Mike%20-%20SmartyStreets's gravatar image

Mike - SmartyStreets
10.4k3
accept rate: 56%

edited 03 Apr, 15:57

Jeffrey%20-%20SmartyStreets's gravatar image

Jeffrey - SmartyStreets ♦♦
2.2k14

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×2

Asked: 21 Feb, 11:58

Seen: 175 times

Last updated: 03 Apr, 15:57