Decrementar columna de la fila
Decrement a specific column of a row by a given value.
/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrementAlcance rows.writeDecrement a specific column of a row by a given value.
Parámetros
Sección titulada «Parámetros»databaseId string obligatorio
Database ID.
tableId string obligatorio
Table ID.
rowId string obligatorio
Row ID.
column string obligatorio
Column key.
value number
Value to increment the column by. The value must be a number.
min number
Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.
transactionId string
Transaction ID for staging the operation.
Acceso: clave de API con el alcance rows.write (también acepta documents.write) o sesión del usuario, o incluso sin sesión (vale lo que permitan los permisos del recurso).
Respuestas
Sección titulada «Respuestas»200Éxito400Parámetro inválido o faltante401Sin sesión, sin permiso en el recurso o clave sin el alcance404Recurso de la ruta no encontrado429Límite de peticionesTodo error llega como JSON con code, type y message: consulta Errores.
import { Client, TablesDB } from '@owbase/web';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const tablesDB = new TablesDB(client);
const result = await tablesDB.decrementRowColumn({ databaseId: '<DATABASE_ID>', tableId: '<TABLE_ID>', rowId: '<ROW_ID>', column: '<COLUMN>', value: 1, // optional min: 0, // optional transactionId: '<TRANSACTION_ID>', // optional});
console.log(result);import { Client, TablesDB } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setSession(''); // The user session to authenticate with
const tablesDB = new TablesDB(client);
const result = await tablesDB.decrementRowColumn({ databaseId: '<DATABASE_ID>', tableId: '<TABLE_ID>', rowId: '<ROW_ID>', column: '<COLUMN>', value: 1, // optional min: 0, // optional transactionId: '<TRANSACTION_ID>', // optional});curl -X PATCH "https://cloud.owbase.dev/v1/tablesdb/<DATABASE_ID>/tables/<TABLE_ID>/rows/<ROW_ID>/<COLUMN>/decrement" \ -H "X-Owbase-Project: <PROJECT_ID>" \ -H "X-Owbase-Key: $OWBASE_API_KEY"{ "$id": "5e5ea5c16897e", "$sequence": "1", "$tableId": "5e5ea5c15117e", "$databaseId": "5e5ea5c15117e", "$createdAt": "2020-10-15T06:38:00.000+00:00", "$updatedAt": "2020-10-15T06:38:00.000+00:00", "$permissions": [ "read(\"any\")" ]}Las descripciones de esta página vienen de la especificación de la API del servidor (licencia BSD-3-Clause), en inglés, y los ejemplos vienen del generador de SDKs (licencia MIT). Los avisos completos están en el archivo NOTICE de los paquetes @owbase/web y @owbase/node.