OpenCage Get JSON

1积分/次
ae_opencage_get_json

使用 OpenCage 按名称或坐标搜索地点,并以 JSON 格式返回结果。

地图
1积分/次

价格说明

1积分/次
条件费用
每次调用1积分/次

工具参数

未传入的可选参数将使用平台默认值。

参数类型必填说明默认值
qstring是string or lat,lng to be geocoded—
abbrvboolean否when true we attempt to abbreviate the formatted field of results.false
jsonpstring否wraps the returned JSON with a function name.—
limitinteger否maximum number of results to return. Default is 10. Maximum is 100.10
boundsstring否four coordinate points forming the south-west and north-east corners of a bounding box—
prettyboolean否when true results are pretty printedfalse
languagestring否an IETF format language code or "native"—
roadinfoboolean否when true we geocode to nearest road, include roadinfo annotationfalse
no_dedupeboolean否when true results are not deduplicatedfalse
no_recordboolean否when true query content is not loggedfalse
proximitystring否lat,lng to bias results—
add_requestboolean否if true the request is included in the response.false
countrycodestring否CSV list of lowercase two letter ISO 3166-1 Alpha 2 codes to limit results to that country/countries.—
address_onlyboolean否when true we include only address details in the formatted field of results.false
no_annotationsenum (0 | 1)否Set to "1" to omit annotations from results, or "0" to include them.0

调用示例

查询坐标 52.5432379, 13.4142133 的 OpenCage 地理编码结果(请求因 no_annotations 类型错误返回 400)

POST/agent-api/v1/tool/executeX-Api-Key
请求代码request.sh
curl --request POST \
  --url 'https://agentearth.ai/agent-api/v1/tool/execute?tool_name=ae_opencage_get_json' \
  --header "X-Api-Key: $AGENTEARTH_API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "params": {
    "abbrv": false,
    "add_request": false,
    "address_only": false,
    "limit": 10,
    "no_annotations": "0",
    "no_dedupe": false,
    "no_record": false,
    "pretty": false,
    "q": "52.5432379, 13.4142133",
    "roadinfo": false
  }
}'
返回示例response.json
JSON部分内容
{
  "documentation": "https://opencagedata.com/api",
  "licenses": [
    {
      "name": "see attribution guide",
      "url": "https://opencagedata.com/credits"
    }
  ],
  "results": [],
  "status": {
    "code": 400,
    "message": "Value \"false\" did not pass type constraint \"Int\""
  },
  "stay_informed": {
    "blog": "https://blog.opencagedata.com",
    "mastodon": "https://en.osm.town/@opencage"
  },
  "thanks": "For using an OpenCage API"
}

返回示例仅展示部分内容,不代表完整响应;复制内容为合法 JSON。