pagehive

upsert_values

Create or replace up to 100 values in one call and one transaction.

ValuesChanges dataAll plans

What it does

Create or replace up to 100 values in one call and one transaction. Each item has the fields of upsert_value. If any item fails, nothing is written and details.errors lists each failure by index. site_id puts new values on that site unless an item sets its own. The response lists each saved value in the order sent, plus created and updated counts, and hides a secret's content.

Plans

Works on every plan: Free, Basic, Pro and Ultra.

Parameters

NameTypeAbout
valuesrequiredarray of objectsUp to 100 items, each with the fields of upsert_value: key, type (required for a new key), value, and optional format, read_access, template_safe and site_id.
site_idstringPuts new values on this site, unless an item sets its own site_id.

Example

Call upsert_values with these arguments:

{
  "site_id": "01a1…",
  "values": [
    {
      "key": "opening_hours",
      "type": "text",
      "value": "Mon–Fri 9:00–17:00"
    },
    {
      "key": "today_total",
      "type": "number",
      "value": 42
    }
  ]
}

Ids like 01a1… stand for your own. list_sites and list_tables give you the real ones.

Related guides

  • ValuesSingle facts, such as a total, a status or a token.