在Firestore Rest API中使用某些字段值创建文档

时间:2019-09-11 07:03:17

标签: firebase rest google-cloud-firestore deluge

switch( $key->jeniskelamin ){
    case 'L':$jeniskelamin = "Laki-laki"; break;
    case 'P':$jeniskelamin = "Perempuan"; break;
    default:$jeniskelamin = "error"; break;
}

但是答案是

https://firestore.googleapis.com/v1beta1/projects/sample/databases/(default)/documents/samplecollection

//this is my end point and type is POST

//parameters :

{
  "fields": {
    "Name": {
      "stringValue": "Sample Name"
    }
  }
}

我的洪水代码:

{"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"{\"Name\":{\"stringValue\":\"Sample Name\"}}","description":"Error expanding 'fields' parameter. Cannot find matching fields for path '{\"Name\":{\"stringValue\":\"Sample Name\"}}'."}]}]}}

如何在Firestore Rest API中使用某些字段值创建文档?

任何解决方案。预先感谢。

0 个答案:

没有答案