HTTP bad request (solved)

Hi there
I am attempting to update a record. The data is in firestore. I can successfully read the data… My schema is as such (stripped real variables and data):
{
“name”: “projects/MYPROJECT/databases/(default)/documents/charters/XYXYXYXYXYXYXYXYX”,
“fields”: {
“this_list”: {
“arrayValue”: {
“values”: [
{
“stringValue”: “HSHSHSHS”
},
{
“stringValue”: “KJKJDKJD”
}
]
}
},
“thisDate”: {
“stringValue”: “2021-09-10”
},
“someVal”: {
“stringValue”: “FJDHJFHDJHFD”
},
“thisTime”: {
“stringValue”: “06:45am”
}
},
“createTime”: “2021-09-10T03:21:08.618864Z”,
“updateTime”: “2021-09-23T06:05:27.264635Z”
}

I am wanting to add an item to “this_list”

I have a list the user can choose from and the item chosen gets added to a page variable that is a copy of this_list. I append that page variable with the new item. That works just fine.

What I am unable to do is update the record with the updated list.
My HTTP request is as follows… (stripped of real parameters)
{“fields”:
{ “someVal”:
{ “stringValue”: someVariable },
“thisTime”:
{ “stringValue”: someVariable },
“thisDate”: { “stringValue”: someVariable },
“this_list”: { “arrayValue”: { “values”: ListVariable } } }}

I put the output of the HTTP request into a variable (I cant get debugger to work)… and put that on the screen…
I am getting… (not stripped of any content)

{“error”:{“code”:400,“message”:“Invalid value at ‘document.fields[3].value.array_value.values[0]’ (type.googleapis.com/google.firestore.v1.Value), “yMMfMdqzvC3zJxUPly8f”\nInvalid value at ‘document.fields[3].value.array_value.values[1]’ (type.googleapis.com/google.firestore.v1.Value), “upIWeYYVubiqtYgT8yUm”\nInvalid value at ‘document.fields[3].value.array_value.values[2]’ (type.googleapis.com/google.firestore.v1.Value), “VelBXbOywjlhcUYW6YIF””,“status”:“INVALID_ARGUMENT”,“details”:[{"@type":“type.googleapis.com/google.rpc.BadRequest",“fieldViolations”:[{“field”:“document.fields[3].value.array_value.values[0]”,“description”:"Invalid value at ‘document.fields[3].value.array_value.values[0]’ (type.googleapis.com/google.firestore.v1.Value), “yMMfMdqzvC3zJxUPly8f””},{“field”:“document.fields[3].value.array_value.values[1]”,“description”:“Invalid value at ‘document.fields[3].value.array_value.values[1]’ (type.googleapis.com/google.firestore.v1.Value), “upIWeYYVubiqtYgT8yUm””},{“field”:“document.fields[3].value.array_value.values[2]”,“description”:“Invalid value at ‘document.fields[3].value.array_value.values[2]’ (type.googleapis.com/google.firestore.v1.Value), “VelBXbOywjlhcUYW6YIF””}]}]}}

So… somehow… updating the list is not working but I am not sure how to resolve this.

I got this to work!!
I ended up using the Update Record (with firestore connector). This was a much easier approach.

1 Like