I'm trying to create a new document id and store my collection inside it. My post looks like this:
{
"name": "projects/<project-id>/databases/(default)/documents/users/cena123",
"fields": {
"name": {
"stringValue": "tom"
},
"lname": {
"stringValue": "cruise"
}
ERROR i get:
error": { "code": 400, "message": "Invalid JSON payload received. Unknown name \" {\r\n \"name\": \"projects/mountain-bear-****/databases/(default)/documents/users/cena123\",\r\n
What T'm trying to achieve:
The reason you are receiving "code": 400, "message": "Invalid JSON payload received. Unknown name
error, is because name
should not be passed in the request body, unless it's inside the fields object. Use the below json in your request body.
{
"fields": {
"name": {
"stringValue": "tom"
},
"lname": {
"stringValue": "cruise"
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.