Update a query of a Tulip Table
  • 17 Jan 2024
  • 4 Minutes to read
  • Contributors

Update a query of a Tulip Table


Article summary

Put
/tables/{tableId}/query/{queryId}

Updates a query in a Tulip Table by the query id

Requires the table-queries: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]+$
queryId
stringRequired

The id of a Tulip Table query.

Pattern^[a-zA-Z0-9]+$
Body parameters

The updated Tulip Table query. All fields must be set.

Expand All
object
tableId
string Required

The ID of the Tulip Table that the query is being created on.

label
string Required

The display label for the query.

Max length255
Min length1
filters
Array of object (TulipTableFilter)

The filters that the query uses.

object

The filters can use any of the columns defined in the Tulip Table (including _createdAt and _updatedAt) that the query exists on with any of the functions.

_id
string Required
field
string Required
functionType
string Required
Valid values[ "equal", "notEqual", "blank", "notBlank", "greaterThanOrEqual", "lessThanOrEqual", "greaterThan", "lessThan", "contains", "notContains", "startsWith", "notStartsWith", "endsWith", "notEndsWith", "isIn" ]
value
object

The value to compare to.

If datasourceType is set to "app-info", then params is not required.

If datasourceType is set to "static", then params is required.

datasourceType
string Required
Valid values[ "static", "app-info" ]
params
object
value

The static value to compare to. Must be of the same type as the data in the column specified by field.

filterAggregator
string

The aggregator of all filters defined on the query.

sortOptions
Array of object (TulipTableSortOption)

The sorts that will order the records returned by the query.

object

Sorts are used to order the queries based on columns defined in the Tulip Table where the query exists.

sortBy
string Required

The field that records should be sorted by in the response. Can be the name of any of the columns of the Table (including id) or one of these special values:

  • _sequenceNumber
  • _createdAt
  • _updatedAt
sortDir
string Required

The direction of the records, either acsending or descending

Valid values[ "asc", "desc" ]
Default"asc"
limit
number Required

The number of records that the query returns.

Maximum1000
Minimum1
Default"1000"
Responses
200

The Tulip Table query was updated successfully. The details of the updated Table query are returned in the response.

Expand All
object

A Tulip Table query that exists on a Tulip Table. The record object will include all the fields of the query, addition to the record's created timestamp and last updated timestamp.

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

The ID of the Tulip Table that the query exists on.

label
string

The name of the Tulip Table Query.

filters
Array of object (TulipTableFilter)

The filters that are applied on this Tulip Table Query.

object

The filters can use any of the columns defined in the Tulip Table (including _createdAt and _updatedAt) that the query exists on with any of the functions.

_id
string
field
string
functionType
string
Valid values[ "equal", "notEqual", "blank", "notBlank", "greaterThanOrEqual", "lessThanOrEqual", "greaterThan", "lessThan", "contains", "notContains", "startsWith", "notStartsWith", "endsWith", "notEndsWith", "isIn" ]
value
object

The value to compare to.

If datasourceType is set to "app-info", then params is not required.

If datasourceType is set to "static", then params is required.

datasourceType
string
Valid values[ "static", "app-info" ]
params
object
value

The static value to compare to. Must be of the same type as the data in the column specified by field.

filterAggregator
string

How the filters applied on this Tulip Table Query are aggregated.

sortOptions
Array of object (TulipTableSortOption)

The field and sorting direction used to sort the query results

object

Sorts are used to order the queries based on columns defined in the Tulip Table where the query exists.

sortBy
string

The field that records should be sorted by in the response. Can be the name of any of the columns of the Table (including id) or one of these special values:

  • _sequenceNumber
  • _createdAt
  • _updatedAt
sortDir
string

The direction of the records, either acsending or descending

Valid values[ "asc", "desc" ]
Default"asc"
limit
number

The number of records that will be returned at most from this Tulip Table query.

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 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
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?