我设法使用接近 API 成功注册了一个信标,并且可以在列出活动信标时看到它,但是我无法使用更新方法修改信标信息。
这里是注册成功的包装
{
"beaconName": "beacons/3!6564643165626561653336383637373435326335",
"advertisedId": {
"type": "EDDYSTONE",
"id": "ZWRkMWViZWFlMzY4Njc3NDUyYzU="
},
"status": "ACTIVE",
"latLng": {
"latitude": <removed>,
"longitude": <removed>
}
}
这是列表操作 GET https://proximitybeacon.googleapis.com/v1beta1/beacons的结果
{
"beacons": [
{
"beaconName": "beacons/3!6564643165626561653336383637373435326335",
"advertisedId": {
"type": "EDDYSTONE",
"id": "ZWRkMWViZWFlMzY4Njc3NDUyYzU="
},
"status": "ACTIVE",
"latLng": {
"latitude": <removed>,
"longitude": <removed>
}
}
]
}
但是尝试调用 PUT 进行更新给了我 400 PUT /v1beta1/beacons/3%216564643165626561653336383637373435326335
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"{ \"status\": \"ACTIVE\", \"latLng\": { \"latitude\": <removed>, \"longitude\": <removed> }}\": Cannot bind query parameter. Field '{ \"status\": \"ACTIVE\", \"latLng\": { \"latitude\": -35' could not be found in request message.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid JSON payload received. Unknown name \"{ \"status\": \"ACTIVE\", \"latLng\": { \"latitude\": <removed>, \"longitude\": <removed> }}\": Cannot bind query parameter. Field '{ \"status\": \"ACTIVE\", \"latLng\": { \"latitude\": -35' could not be found in request message."
}
]
}
]
}
}
数据包本身非常简单
{
"status":"ACTIVE",
"latLng": {
"latitude": <removed>,
"longitude": <removed>
},
"indoorLevel": {
"name": "4"
},
"status": "PORTABLE"
}
不完全确定错误的原因是什么以及如何解决。