diff --git a/api-reference/v2/resources/changelog.mdx b/api-reference/v2/resources/changelog.mdx index 4c3e3db..051622b 100644 --- a/api-reference/v2/resources/changelog.mdx +++ b/api-reference/v2/resources/changelog.mdx @@ -3,6 +3,10 @@ title: Glide API Changelog sidebarTitle: Changelog --- +### September 18, 2024 + +- Endpoints that receive tabular data can now accept CSV and TSV request bodies. + ### September 13, 2024 - Introduced a new "Limits" document that outlines rate and operational limits for the API. diff --git a/api-reference/v2/stashing/put-stashes-serial.mdx b/api-reference/v2/stashing/put-stashes-serial.mdx index e1f1077..a619f4c 100644 --- a/api-reference/v2/stashing/put-stashes-serial.mdx +++ b/api-reference/v2/stashing/put-stashes-serial.mdx @@ -5,6 +5,8 @@ openapi: put /stashes/{stashID}/{serial} When using large datasets with the Glide API, it may be necessary to break them into smaller chunks for performance and reliability. We call this process "stashing." +Tabular data may be stashed in JSON, CSV, or TSV format. + To learn more about stashing and how to use it to work with large datasets, please see our [introduction to stashing](/api-reference/v2/stashing/introduction). diff --git a/api-reference/v2/tables/post-table-rows.mdx b/api-reference/v2/tables/post-table-rows.mdx index 9e3239f..47899ca 100644 --- a/api-reference/v2/tables/post-table-rows.mdx +++ b/api-reference/v2/tables/post-table-rows.mdx @@ -5,6 +5,8 @@ openapi: post /tables/{tableID}/rows Add row data to an existing Big Table. +Row data may be passed in JSON, CSV, or TSV format. + ## Examples diff --git a/api-reference/v2/tables/post-tables.mdx b/api-reference/v2/tables/post-tables.mdx index a947b17..1d2249c 100644 --- a/api-reference/v2/tables/post-tables.mdx +++ b/api-reference/v2/tables/post-tables.mdx @@ -5,6 +5,8 @@ openapi: post /tables Create a new Big Table, define its structure, and (optionally) populate it with data. +When using a CSV or TSV request body, the name of the table must be passed as a query parameter and the schema of the table is inferred from the content. Alternatively, the CSV/TSV content may be [stashed](/api-reference/v2/stashing/introduction), and then the schema and name may be passed in the regular JSON payload. + ## Examples diff --git a/api-reference/v2/tables/put-tables.mdx b/api-reference/v2/tables/put-tables.mdx index b119370..eaf42a7 100644 --- a/api-reference/v2/tables/put-tables.mdx +++ b/api-reference/v2/tables/put-tables.mdx @@ -5,6 +5,8 @@ openapi: put /tables/{tableID} Overwrite an existing Big Table by clearing all rows and adding new data. You can also update the table schema. +When using a CSV or TSV request body, you cannot pass a schema. The current schema will be used. If you need to update the schema, use the `onSchemaError=updateSchema` query parameter, or [stash](/api-reference/v2/stashing/introduction) the CSV/TSV data and pass a JSON request body. + This is a destructive operation that cannot be undone. diff --git a/openapi/swagger.json b/openapi/swagger.json index 292dcc6..fbd97ae 100644 --- a/openapi/swagger.json +++ b/openapi/swagger.json @@ -215,8 +215,17 @@ } } }, - "description": "Creates a new Big Table", "parameters": [ + { + "name": "name", + "in": "query", + "schema": { + "type": "string", + "description": "Name of the table. Required when the name is not passed in the request body. It is an error to pass a name in both this query parameter and the request body.", + "example": "Invoices" + }, + "required": false + }, { "name": "onSchemaError", "in": "query", @@ -386,9 +395,24 @@ ], "additionalProperties": false } + }, + "text/csv": { + "schema": { + "type": "string", + "description": "A CSV string. The first line is column IDs, and each subsequent line is a row of data. The schema will be inferred from the data. The name of the table must be passed in the query parameter `name`.", + "example": "Name,Age,Birthday\nAlice,25,2024-08-29T09:46:16.722Z\nBob,30,2020-01-15T09:00:16.722Z" + } + }, + "text/tab-separated-values": { + "schema": { + "type": "string", + "description": "A TSV string. The first line is column IDs, and each subsequent line is a row of data. The schema will be inferred from the data. The name of the table must be passed in the query parameter `name`.", + "example": "Name\tAge\tBirthday\nAlice\t25\t2024-08-29T09:46:16.722Z\nBob\t30\t2020-01-15T09:00:16.722Z" + } } } - } + }, + "description": "Creates a new Big Table" } }, "/tables/{tableID}": { @@ -537,7 +561,6 @@ } } }, - "description": "Overwrites a Big Table with new schema and/or data", "parameters": [ { "name": "tableID", @@ -712,9 +735,24 @@ ], "additionalProperties": false } + }, + "text/csv": { + "schema": { + "type": "string", + "description": "A CSV string. The first line is column IDs, and each subsequent line is a row of data.", + "example": "Name,Age,Birthday\nAlice,25,2024-08-29T09:46:16.722Z\nBob,30,2020-01-15T09:00:16.722Z" + } + }, + "text/tab-separated-values": { + "schema": { + "type": "string", + "description": "A TSV string. The first line is column IDs, and each subsequent line is a row of data.", + "example": "Name\tAge\tBirthday\nAlice\t25\t2024-08-29T09:46:16.722Z\nBob\t30\t2020-01-15T09:00:16.722Z" + } } } - } + }, + "description": "Replaces the schema and/or data of a Big Table" } }, "/tables/{tableID}/rows": { @@ -862,7 +900,6 @@ } } }, - "description": "Adds rows to a Big Table", "parameters": [ { "name": "tableID", @@ -935,9 +972,24 @@ } ] } + }, + "text/csv": { + "schema": { + "type": "string", + "description": "A CSV string. The first line is column IDs, and each subsequent line is a row of data.", + "example": "Name,Age,Birthday\nAlice,25,2024-08-29T09:46:16.722Z\nBob,30,2020-01-15T09:00:16.722Z" + } + }, + "text/tab-separated-values": { + "schema": { + "type": "string", + "description": "A TSV string. The first line is column IDs, and each subsequent line is a row of data.", + "example": "Name\tAge\tBirthday\nAlice\t25\t2024-08-29T09:46:16.722Z\nBob\t30\t2020-01-15T09:00:16.722Z" + } } } - } + }, + "description": "Adds rows to a Big Table" } }, "/stashes/{stashID}/{serial}": { @@ -989,7 +1041,6 @@ } } }, - "description": "Sets the content of a chunk of data inside a stash", "parameters": [ { "name": "stashID", @@ -1039,9 +1090,24 @@ } ] } + }, + "text/csv": { + "schema": { + "type": "string", + "description": "A CSV string. The first line is column IDs, and each subsequent line is a row of data.", + "example": "Name,Age,Birthday\nAlice,25,2024-08-29T09:46:16.722Z\nBob,30,2020-01-15T09:00:16.722Z" + } + }, + "text/tab-separated-values": { + "schema": { + "type": "string", + "description": "A TSV string. The first line is column IDs, and each subsequent line is a row of data.", + "example": "Name\tAge\tBirthday\nAlice\t25\t2024-08-29T09:46:16.722Z\nBob\t30\t2020-01-15T09:00:16.722Z" + } } } - } + }, + "description": "Sets the content of a chunk of data inside a stash" } }, "/stashes/{stashID}": { @@ -1093,7 +1159,6 @@ } } }, - "description": "Deletes a stash and all its data", "parameters": [ { "name": "stashID", @@ -1106,7 +1171,8 @@ }, "required": true } - ] + ], + "description": "Deletes a stash and all its data" } } },