Bucket Schemas
/api/v2/buckets/{bucketID}/schema/measurementsList measurement schemas of a bucket
Lists explicit
schemas
("schemaType": "explicit") for a bucket.
Explicit schemas are used to enforce column names, tags, fields, and data types for your data.
By default, buckets have an implicit schema-type ("schemaType": "implicit")
that conforms to your data.
Related guides
Parameters
Path parameters
bucketID
required
stringQuery parameters
org
stringorgID
stringname
stringcurl --request GET \
"https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/buckets/{bucketID}/schema/measurements" \
--header "Authorization: Bearer INFLUX_TOKEN"Responses
measurementSchemas
required
object[]{
"measurementSchemas": [
{
"bucketID": "ba3c5e7f9b0a0010",
"createdAt": "2021-01-21T00:48:40.993Z",
"id": "1a3c5e7f9b0a8642",
"name": "cpu",
"orgID": "0a3c5e7f9b0a0001",
"updatedAt": "2021-01-21T00:48:40.993Z"
},
{
"bucketID": "ba3c5e7f9b0a0010",
"createdAt": "2021-01-21T00:48:40.993Z",
"id": "1a3c5e7f9b0a8643",
"name": "memory",
"orgID": "0a3c5e7f9b0a0001",
"updatedAt": "2021-01-21T00:48:40.993Z"
},
{
"bucketID": "ba3c5e7f9b0a0010",
"createdAt": "2021-01-21T00:48:40.993Z",
"id": "1a3c5e7f9b0a8644",
"name": "disk",
"orgID": "0a3c5e7f9b0a0001",
"updatedAt": "2021-01-21T00:48:40.993Z"
}
]
}code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringUnauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to this organization and bucket.
code
stringunauthorized.unauthorizedmessage
stringNot found. A requested resource was not found. The response body contains the requested resource type and the name value (if you passed it)–for example:
"organization name \"my-org\" not found""organization not found": indicates you passed an ID that did not match an organization.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
string/api/v2/buckets/{bucketID}/schema/measurementsCreate a measurement schema for a bucket
Creates an explicit measurement schema for a bucket.
Explicit schemas are used to enforce column names, tags, fields, and data types for your data.
By default, buckets have an implicit schema-type ("schemaType": "implicit")
that conforms to your data.
Use this endpoint to create schemas that prevent non-conforming write requests.
Limitations
- Buckets must be created with the “explicit”
schemaTypein order to use schemas.
Related guides
Parameters
Path parameters
bucketID
required
stringQuery parameters
org
stringorgID
stringRequest body required
application/jsoncolumns
required
object[]name
required
string{
"columns": [
{
"format": "unix timestamp",
"name": "time",
"type": "integer"
},
{
"name": "host",
"type": "tag"
},
{
"name": "region",
"type": "tag"
},
{
"dataType": "float",
"name": "usage_user",
"type": "field"
},
{
"dataType": "float",
"name": "usage_user",
"type": "field"
}
],
"name": "cpu"
}curl --request POST \
"https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/buckets/{bucketID}/schema/measurements" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{"columns":[{"format":"unix timestamp","name":"time","type":"integer"},{"name":"host","type":"tag"},{"name":"region","type":"tag"},{"dataType":"float","name":"usage_user","type":"field"},{"dataType":"float","name":"usage_user","type":"field"}],"name":"cpu"}'Responses
bucketID
stringcolumns
required
object[]createdAt
required
string <date-time>id
required
stringname
required
stringorgID
stringupdatedAt
required
string <date-time>{
"bucketID": "ba3c5e7f9b0a0010",
"columns": [
{
"format": "unix timestamp",
"name": "time",
"type": "integer"
},
{
"name": "host",
"type": "tag"
},
{
"name": "region",
"type": "tag"
},
{
"dataType": "float",
"name": "usage_user",
"type": "field"
},
{
"dataType": "float",
"name": "usage_user",
"type": "field"
}
],
"createdAt": "2021-01-21T00:48:40.993Z",
"id": "1a3c5e7f9b0a8642",
"name": "cpu",
"orgID": "0a3c5e7f9b0a0001",
"updatedAt": "2021-01-21T00:48:40.993Z"
}code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringUnauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to this organization and bucket.
code
stringunauthorized.unauthorizedmessage
stringNot found. A requested resource was not found. The response body contains the requested resource type and the name value (if you passed it)–for example:
"organization name \"my-org\" not found""organization not found": indicates you passed an ID that did not match an organization.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
string/api/v2/buckets/{bucketID}/schema/measurements/{measurementID}Retrieve a measurement schema
Parameters
Path parameters
bucketID
required
stringmeasurementID
required
stringQuery parameters
org
stringorgID
stringcurl --request GET \
"https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/buckets/{bucketID}/schema/measurements/{measurementID}" \
--header "Authorization: Bearer INFLUX_TOKEN"Responses
bucketID
stringcolumns
required
object[]createdAt
required
string <date-time>id
required
stringname
required
stringorgID
stringupdatedAt
required
string <date-time>{
"bucketID": "ba3c5e7f9b0a0010",
"columns": [
{
"format": "unix timestamp",
"name": "time",
"type": "integer"
},
{
"name": "host",
"type": "tag"
},
{
"name": "region",
"type": "tag"
},
{
"dataType": "float",
"name": "usage_user",
"type": "field"
},
{
"dataType": "float",
"name": "usage_user",
"type": "field"
}
],
"createdAt": "2021-01-21T00:48:40.993Z",
"id": "1a3c5e7f9b0a8642",
"name": "cpu",
"orgID": "0a3c5e7f9b0a0001",
"updatedAt": "2021-01-21T00:48:40.993Z"
}Unauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to this organization and bucket.
code
stringunauthorized.unauthorizedmessage
stringNot found. A requested resource was not found. The response body contains the requested resource type and the name value (if you passed it)–for example:
"organization name \"my-org\" not found""organization not found": indicates you passed an ID that did not match an organization.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
string/api/v2/buckets/{bucketID}/schema/measurements/{measurementID}Update a measurement schema
Updates a measurement schema.
Use this endpoint to update the fields (name, type, and dataType) of a
measurement schema.
Limitations
- You can’t update the
nameof a measurement.
Related guides
Parameters
Path parameters
bucketID
required
stringmeasurementID
required
stringQuery parameters
org
stringorgID
stringRequest body required
application/jsoncolumns
required
object[]{
"columns": [
{
"format": "unix timestamp",
"name": "time",
"type": "integer"
},
{
"name": "host",
"type": "tag"
},
{
"name": "region",
"type": "tag"
},
{
"dataType": "float",
"name": "usage_user",
"type": "field"
},
{
"dataType": "float",
"name": "usage_user",
"type": "field"
}
]
}curl --request PATCH \
"https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/buckets/{bucketID}/schema/measurements/{measurementID}" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{"columns":[{"format":"unix timestamp","name":"time","type":"integer"},{"name":"host","type":"tag"},{"name":"region","type":"tag"},{"dataType":"float","name":"usage_user","type":"field"},{"dataType":"float","name":"usage_user","type":"field"}]}'Responses
bucketID
stringcolumns
required
object[]createdAt
required
string <date-time>id
required
stringname
required
stringorgID
stringupdatedAt
required
string <date-time>{
"bucketID": "ba3c5e7f9b0a0010",
"columns": [
{
"format": "unix timestamp",
"name": "time",
"type": "integer"
},
{
"name": "host",
"type": "tag"
},
{
"name": "region",
"type": "tag"
},
{
"dataType": "float",
"name": "usage_user",
"type": "field"
},
{
"dataType": "float",
"name": "usage_user",
"type": "field"
}
],
"createdAt": "2021-01-21T00:48:40.993Z",
"id": "1a3c5e7f9b0a8642",
"name": "cpu",
"orgID": "0a3c5e7f9b0a0001",
"updatedAt": "2021-01-21T00:48:40.993Z"
}code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringUnauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to this organization and bucket.
code
stringunauthorized.unauthorizedmessage
stringNot found. A requested resource was not found. The response body contains the requested resource type and the name value (if you passed it)–for example:
"organization name \"my-org\" not found""organization not found": indicates you passed an ID that did not match an organization.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringWas this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.