如何 运行 查询与 API 休息?
How to run query with API rest?
所以我正在尝试 运行 使用 Godot
对 firebase rest api 进行查询
为了让您了解这是我更新文档的方式:
func update_document(http: HTTPRequest) -> void:
var fields = {}
fields.Name = {"stringValue": "Martin"}
var document := { "fields": fields }
var body := to_json(document)
var url := "https://firestore.googleapis.com/v1/projects/my_project_id/databases/(default)/documents/Users"
http.request(url, _get_request_headers(), false, HTTPClient.METHOD_PATCH, body)
现在我正在尝试查询 return 100 个最好的分数,我正在尝试,首先,运行 宁一个简单的查询但不工作,它是 returning 错误 400:
func query_document(http: HTTPRequest) -> void:
var fields = {
"structuredQuery": {
"from": [{
"collectionId": "Users"
}],
"where": {
"fieldFilter": {
"field": {
"fieldPath": "total"
},
"op": "EQUAL",
"value": {
"intetgerValue": "10",
}
}
}
}
}
var document := { "fields": fields }
var body := to_json(document)
var url := "https://firestore.googleapis.com/v1beta1/projects/myproject_id/databases/(default)/documents:runQuery"
http.request(url, _get_request_headers(), false, HTTPClient.METHOD_POST,body)
缺少 select,添加 select 使其工作。
所以我正在尝试 运行 使用 Godot
对 firebase rest api 进行查询为了让您了解这是我更新文档的方式:
func update_document(http: HTTPRequest) -> void:
var fields = {}
fields.Name = {"stringValue": "Martin"}
var document := { "fields": fields }
var body := to_json(document)
var url := "https://firestore.googleapis.com/v1/projects/my_project_id/databases/(default)/documents/Users"
http.request(url, _get_request_headers(), false, HTTPClient.METHOD_PATCH, body)
现在我正在尝试查询 return 100 个最好的分数,我正在尝试,首先,运行 宁一个简单的查询但不工作,它是 returning 错误 400:
func query_document(http: HTTPRequest) -> void:
var fields = {
"structuredQuery": {
"from": [{
"collectionId": "Users"
}],
"where": {
"fieldFilter": {
"field": {
"fieldPath": "total"
},
"op": "EQUAL",
"value": {
"intetgerValue": "10",
}
}
}
}
}
var document := { "fields": fields }
var body := to_json(document)
var url := "https://firestore.googleapis.com/v1beta1/projects/myproject_id/databases/(default)/documents:runQuery"
http.request(url, _get_request_headers(), false, HTTPClient.METHOD_POST,body)
缺少 select,添加 select 使其工作。