如何使用 Avalara 的 REST api 验证地址?

How do I validate an address using Avalara's REST api?

我一直在查看 AvaTax API 文档 https://developer.avalara.com/api-reference/avatax/rest/v2/,想知道不仅可以验证地址,还可以发现税务机关数据的最佳方法?推荐的方法是什么?

您可以检索指定地址的地理位置和 jurisdiction/tax 权限信息。

如果提供的地址 可以 解析,它将针对 Avalara 的地址验证系统进行解析。

参见:https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Addresses/ResolveAddress/

有两种获取结果的方法:

GET https://sandbox-rest.avatax.com/api/v2/addresses/resolve?line1=255 S King St %231800&city= Seattle&region=wa&postalCode=98104&country=US&textCase=Mixed

POST https://sandbox-rest.avatax.com/api/v2/addresses/resolve

{
"line1": "255 S King St",
"textCase": "Mixed",
"city": "Seattle",
"region": "WA",
"country": "US",
"postalCode":"98104"
}     

上述示例的结果如下所示:

{
"address": {
    "textCase": "Mixed",
    "line1": "255 S King St",
    "city": "seattle",
    "region": "WA",
    "country": "US",
    "postalCode": "98104"
},
"validatedAddresses": [
    {
        "addressType": "HighRiseOrBusinessComplex",
        "line1": "255 S King St",
        "line2": "",
        "line3": "",
        "city": "Seattle",
        "region": "WA",
        "country": "US",
        "postalCode": "98104-3317",
        "latitude": 47.59821,
        "longitude": -122.33108
    }
],
"coordinates": {
    "latitude": 47.59821,
    "longitude": -122.33108
},
"resolutionQuality": "Intersection",
"taxAuthorities": [
    {
        "avalaraId": "2986",
        "jurisdictionName": "KING",
        "jurisdictionType": "County",
        "signatureCode": "BVVZ"
    },
    {
        "avalaraId": "61",
        "jurisdictionName": "WASHINGTON",
        "jurisdictionType": "State",
        "signatureCode": "BVPJ"
    },
    {
        "avalaraId": "167796",
        "jurisdictionName": "SEATTLE",
        "jurisdictionType": "City",
        "signatureCode": "BVXK"
    }
]
}