Logo
Section 1 / 2

API 工具类

学习使用AvaTax API提供的一些实用端点。

导入

API 工具类

学习使用AvaTax API提供的一些实用端点。

代码示例

1https://sandbox-rest.avatax.com/api/v2/utilities/ping
1# 账户 ID 和许可证密钥 2account_id = "{{ACCOUNT_ID}}" 3license_key = "{{LICENSE_KEY}}" 4 5# 接口地址 6endpoint_url = "https://sandbox-rest.avatax.com/api/v2/utilities/ping" 7 8# 使用账户 ID 和许可证密钥创建基础认证令牌 9auth_token = requests.auth.HTTPBasicAuth(account_id, license_key) 10 11# 向 AvaTax API 发送 GET 请求 12response = requests.get(url=endpoint_url, auth=auth_token) 13 14# 打印响应结果 15print_response(response)

响应字段

字段名类型描述
version字符串该字段表示返回 ping 响应的 AvaTax API 版本号。
authenticated布尔值该字段表示 Avalara 是否成功验证了我们发送的凭证。
authenticationType字符串该字段表示我们凭证的认证类型。
authenticatedUserName字符串该字段表示已认证的 Avalara 账户用户名。
authenticatedUserId整数该字段表示已认证的 Avalara 用户 ID。
authenticatedAccountId整数该字段表示已认证的 Avalara 账户 ID。

代码示例

1https://sandbox-rest.avatax.com/api/v2/utilities/subscriptions
1# 账户 ID 和许可证密钥 2account_id = "{{ACCOUNT_ID}}" 3license_key = "{{LICENSE_KEY}}" 4 5# 接口地址 6endpoint_url = "https://sandbox-rest.avatax.com/api/v2/utilities/subscriptions" 7 8# 使用账户 ID 和许可证密钥创建基础认证令牌 9auth_token = requests.auth.HTTPBasicAuth(account_id, license_key) 10 11# 向 AvaTax API 发送 GET 请求 12response = requests.get(url=endpoint_url, auth=auth_token) 13 14# 打印响应结果 15print_response(response)

响应字段

字段名类型描述
value订阅对象数组该字段表示 Avalara 订阅列表。
subscriptionTypeId整数该字段表示订阅类型的 ID。
subscriptionDescription字符串该字段表示订阅的描述信息。

结论

API 对象的详细信息