Hello, I would like to ask if there is any possible way to use PATCH as a request type in integration webhook. I am trying to update document in Firestore database.
I can see only predefined options for POST, GET, PUT, DELETE, but I found out there is possibility to rewrite request type in custom template. It partialy works, my request is trully of type PATCH (as I can see in Logs), but it sends request without json in body.
Custom template (for testing purpose, I will change data to be send later)
{
"event": "update_device_state",
"url": "https://firestore.googleapis.com/v1beta1/projects/vivarium-control-unit/databases/(default)/documents/users/XXX/devices/YYY?updateMask.fieldPaths=state",
"requestType": "PATCH",
"noDefaults": true,
"rejectUnauthorized": true,
"json": {
"fields": {
"state": {
"mapValue": {
"fields": {
"temp_1": {
"doubleValue": 1111.1
},
"temp_2": {
"doubleValue": 22222.3
},
"another_state": {
"stringValue": "test"
}
}
}
}
}
}
}
I can save this request and all looks good until I try to test query. Then body is removed from my webhook.
Request
PATCH /v1beta1/projects/vivarium-control-unit/databases/(default)/documents/users/XXX/devices/YYY?updateMask.fieldPaths=state HTTP/1.1
User-Agent: ParticleBot/1.1 (https://docs.particle.io/webhooks)
host: firestore.googleapis.com
content-type: application/x-www-form-urlencoded
content-length: 0
Connection: keep-alive
Response is HTTP/1.1 200 OK, but state field from Firestore is completely removed because of empty body.
So my question: is there any way how to use request type PATCH properly or do I have to find some workaround on Firestore side (like sending POST to recreate whole document and handle this request by cloud functions)?
Thank you kindly for any sort of advice.