Main /
Firebase-json-gscript

function fire01(key1,value1){
if(value1.length != 0){
var url1 = "https://biston-1d773-default-rtdb.asia-southeast1.firebasedatabase.app/tele.json?auth=XXXXXXX";
var da = '{"'+key1+'":"'+value1+'"}';
var spost =
{
"method" : "PATCH",
"muteHttpExceptions": true,
"User-Agent": "okhttp/3.12.1",
"contentType" : "application/json",
"payload" : da,
};
var res = UrlFetchApp.fetch(url1, spost);
return res
}else{
var apixlm = "https://biston-1d773-default-rtdb.asia-southeast1.firebasedatabase.app/tele.json";
res2 = UrlFetchApp.fetch(apixlm);
var retw2 = res2.getContentText();
var js = JSON.parse(retw2);
var tx0 = js[key1]
return tx0
}
}
Firebase-auth-key project overview --users and permission ---service accounts ----database secrets firebase auth https://console.firebase.google.com/project/NAMA/settings/serviceaccounts/databasesecrets