Increment or decrement a field in a Tulip Table record
  • 17 Jan 2024
  • 2 Minutes to read
  • Contributors

Increment or decrement a field in a Tulip Table record


Article summary

Patch
/tables/{tableId}/records/{recordId}/increment

Increment or decrement an integer or float field of a Tulip Table Record. A decrement is simply a negative increment. The tableId must exist. The recordId must be associated with the tableId. The field name must match the column name of the table. The respective column type in the table must be incrementable. The value type must be incrementable (so an integer or float). If the field type is an integer, then the value can be either an integer or a float, but if it is a float, it will be rounded off (e.g. 2.7 rounds up to 3). If the field type is a float, then the value type can also be either an integer or a float. The record's _updatedAt field will be updated to the current time. If the value to be incremented has not been set yet, then it will be treated like an increment on a 0 value. Requires the tables:write API key scope.

Security
Http
Type basic
A Tulip API key is required to use the Tulip API. API key authentication uses HTTP Basic Authentication as defined by [RFC 7617](https://tools.ietf.org/html/rfc7617). HTTP Basic Authentication uses a generic username/password scheme to authenticate. For Tulip API requests, the password should be the API key's associated secret. The username should have the format `{type}.{version}_{id}`, where `{type}` is the API key type, `{version}` is the type's version number, and `{id}` is the id of the key. Tulip API keys currently are one of two types: * `apikey.2` - user API keys provisioned by creating a Tulip API Bot. The key id is the bot id. * `onetime.1` - temporary API keys provisioned using the `/auth/temporary` endpoint or using the [One-Time API Key page](https://templates.tulip.co/apiKey). These keys are only valid for 30 seconds after provisioning. Once you have determined the username and password you need to use, the `Authorization` header should be set to the value `Basic {credentials}`, where `{credentials}` is the base64-encoded value of the string `{username}:{password}`. See [RFC 7617](https://tools.ietf.org/html/rfc7617) for more details of this encoding.
Path parameters
tableId
stringRequired

The id of a Tulip Table.

Pattern^[a-zA-Z0-9]+$
recordId
stringRequired

The id of a Tulip Table record.

Pattern^[\S]+( +[\S]+)*$
Body parameters

Field to increment or decrement

object
fieldName
string

The field (column) to increment or decrement.

value
number

The amount to increment or decrement by.

Responses
200

The field was incremented or decremented successfuly.

object

A single record stored in a Tulip Table. The record object will include the names and values of all columns of the Table that are not hidden, in addition to the record's sequence number, created timestamp, and last updated timestamp.

_sequenceNumber
integer

A monotonically increasing unique identifier for this record.

_createdAt
string (date-time)
_updatedAt
string (date-time)
400

The request was malformed. This could mean that headers, query parameters, or the request body was unable to be parsed or had unexpected values.

object
errorCode
string
errorUniqueID
string
Pattern^[a-zA-Z0-9+/]+$
Exampleaq21mSKC1rbO87TjC/4Hz2EJHd/v+jxf7MtC315vo0Y
details
string
401

The request was made unauthorized. HTTP Basic Authorization using a Tulip API Key is required for use of the API.

object
errorCode
string
errorUniqueID
string
Pattern^[a-zA-Z0-9+/]+$
Exampleaq21mSKC1rbO87TjC/4Hz2EJHd/v+jxf7MtC315vo0Y
details
string
errorCode
Valid values[ "AuthenticationRequired" ]
403

The provided authentication info was rejected. The response will provide additional details.

object
errorCode
string
errorUniqueID
string
Pattern^[a-zA-Z0-9+/]+$
Exampleaq21mSKC1rbO87TjC/4Hz2EJHd/v+jxf7MtC315vo0Y
details
string
errorCode
Valid values[ "AuthenticationFailed" ]
404

The requested database entry was not found.

object
errorCode
string
errorUniqueID
string
Pattern^[a-zA-Z0-9+/]+$
Exampleaq21mSKC1rbO87TjC/4Hz2EJHd/v+jxf7MtC315vo0Y
details
string
errorCode
Valid values[ "NoSuchDatabaseEntry" ]
422

The request was syntactically sound, but could not be processed due to a logical problem.

object
errorCode
string
errorUniqueID
string
Pattern^[a-zA-Z0-9+/]+$
Exampleaq21mSKC1rbO87TjC/4Hz2EJHd/v+jxf7MtC315vo0Y
details
string
errorCode
Valid values[ "UnprocessableEntity" ]
500

The server encountered an unexpected error.

object
errorCode
string
errorUniqueID
string
Pattern^[a-zA-Z0-9+/]+$
Exampleaq21mSKC1rbO87TjC/4Hz2EJHd/v+jxf7MtC315vo0Y
details
string

Was this article helpful?

What's Next