我正在将方形 API 与 golang 集成到我的软件中。但是当我使用以下 json 对象发送添加客户请求时
出现问题{
"given_name": "Sand Box Customer",
"family_name": "This is a sandbox Family",
"email_address": "sandbox@gmail.com",
"address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"locality": "New York",
"administrative_district_level_1": "NY",
"postal_code": "10003",
"country": "Australia"
},
"phone_number": "1-212-555-4240",
"reference_id": "YOUR_REFERENCE_ID",
"note": "a customer"
}
作为响应,它返回我一个错误:-
{
"errors": [
{
"category": "INVALID_REQUEST_ERROR",
"code": "INVALID_ENUM_VALUE",
"detail": "`Australia` is not a valid enum value for `address.country`.",
"field": "address.country"
}
]
}
为什么我遇到此错误,而它将支持Australia
国家/地区,请参见链接 https://docs.connect.squareup.com/。如何解决此错误?
文档链接:- https://docs.connect.squareup.com/get-started
根据他们的文档,您应该以/ISO_3166-1_alpha-2
格式指定国家/地区。
参考文档
https://docs.connect.squareup.com/api/connect/v2#type-location .
您也可以从中找到更多信息 https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2