Upsert rows by the declared unique key (one table)
POST
/collection/{id}/table/{tableKey}/rows/upsert
Path Parameters
idstring
required·
Resource id
tableKeystring
required·
Table key; main is the default table.
Request Body
mergestring
Possible values:
patchreplace
rowsobject[]
typecastboolean
Response Body
deletedinteger
insertedinteger
replayedboolean
row_idsstring[]
stats
unchangedinteger
updatedinteger
curl -X POST 'https://api.elaichi.ai/collection/<id>/table/<tableKey>/rows/upsert' \
-H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"rows":[],"merge":"patch","typecast":true}'const body = {
"rows": [],
"merge": "patch",
"typecast": true
};
const response = await fetch('https://api.elaichi.ai/collection/<id>/table/<tableKey>/rows/upsert', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
const data = await response.json();
console.log(data);import os
import requests
url = "https://api.elaichi.ai/collection/<id>/table/<tableKey>/rows/upsert"
headers = {
"Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
"Content-Type": "application/json",
}
payload = {
"rows": [],
"merge": "patch",
"typecast": True
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())