Class: HubSpotSDK::Resources::Cms::Hubdb::Tables
- Inherits:
-
Object
- Object
- HubSpotSDK::Resources::Cms::Hubdb::Tables
- Defined in:
- lib/hubspot_sdk/resources/cms/hubdb/tables.rb
Instance Method Summary collapse
-
#clone_draft(table_id_or_name, copy_rows:, is_hubspot_defined:, new_label: nil, new_name: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Clone an existing HubDB table.
-
#create(allow_child_tables:, allow_public_api_access:, columns:, dynamic_meta_tags:, enable_child_table_pages:, label:, name:, use_for_pages:, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Some parameter documentations has been truncated, see Models::Cms::Hubdb::TableCreateParams for more details.
-
#delete(table_id_or_name, request_options: {}) ⇒ nil
Archive (soft delete) an existing HubDB table.
-
#delete_version(version_id, table_id_or_name:, request_options: {}) ⇒ nil
Delete a specific version of a table.
-
#export(table_id_or_name, format_: nil, request_options: {}) ⇒ StringIO
Exports the published version of a table in a specified format.
-
#export_draft(table_id_or_name, format_: nil, request_options: {}) ⇒ StringIO
Exports the draft version of a table to CSV / EXCEL format.
-
#get(table_id_or_name, archived: nil, include_foreign_ids: nil, is_get_localized_schema: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Returns the details for the published version of the specified table.
-
#get_draft(table_id_or_name, archived: nil, include_foreign_ids: nil, is_get_localized_schema: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Get the details for the draft version of a specific HubDB table.
-
#import_draft(table_id_or_name, config: nil, file: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::ImportResult
Import the contents of a CSV file into an existing HubDB table.
-
#initialize(client:) ⇒ Tables
constructor
private
A new instance of Tables.
-
#list(after: nil, archived: nil, content_type: nil, created_after: nil, created_at: nil, created_before: nil, is_get_localized_schema: nil, limit: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Cms::HubDBTableV3>
Some parameter documentations has been truncated, see Models::Cms::Hubdb::TableListParams for more details.
-
#list_draft(after: nil, archived: nil, content_type: nil, created_after: nil, created_at: nil, created_before: nil, is_get_localized_schema: nil, limit: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Cms::HubDBTableV3>
Some parameter documentations has been truncated, see Models::Cms::Hubdb::TableListDraftParams for more details.
-
#publish_draft(table_id_or_name, include_foreign_ids: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Publishes the table by copying the data and table schema changes from draft version to the published version, meaning any website pages using data from the table will be updated.
-
#reset_draft(table_id_or_name, include_foreign_ids: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Replaces the data in the draft version of the table with values from the published version.
-
#unpublish(table_id_or_name, include_foreign_ids: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Unpublishes the table, meaning any website pages using data from the table will not render any data.
-
#update_draft(table_id_or_name, allow_child_tables:, allow_public_api_access:, columns:, dynamic_meta_tags:, enable_child_table_pages:, label:, name:, use_for_pages:, archived: nil, include_foreign_ids: nil, is_get_localized_schema: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Some parameter documentations has been truncated, see Models::Cms::Hubdb::TableUpdateDraftParams for more details.
Constructor Details
#initialize(client:) ⇒ Tables
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Tables.
532 533 534 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 532 def initialize(client:) @client = client end |
Instance Method Details
#clone_draft(table_id_or_name, copy_rows:, is_hubspot_defined:, new_label: nil, new_name: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Clone an existing HubDB table. The ‘newName` and `newLabel` of the new table can be sent as JSON in the request body. This will create the cloned table as a draft.
148 149 150 151 152 153 154 155 156 157 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 148 def clone_draft(table_id_or_name, params) parsed, = HubSpotSDK::Cms::Hubdb::TableCloneDraftParams.dump_request(params) @client.request( method: :post, path: ["cms/hubdb/2026-03/tables/%1$s/draft/clone", table_id_or_name], body: parsed, model: HubSpotSDK::Cms::HubDBTableV3, options: ) end |
#create(allow_child_tables:, allow_public_api_access:, columns:, dynamic_meta_tags:, enable_child_table_pages:, label:, name:, use_for_pages:, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Some parameter documentations has been truncated, see Models::Cms::Hubdb::TableCreateParams for more details.
Creates a new draft HubDB table given a JSON schema. The table name and label should be unique for each account.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 37 def create(params) parsed, = HubSpotSDK::Cms::Hubdb::TableCreateParams.dump_request(params) @client.request( method: :post, path: "cms/hubdb/2026-03/tables", body: parsed, model: HubSpotSDK::Cms::HubDBTableV3, options: ) end |
#delete(table_id_or_name, request_options: {}) ⇒ nil
Archive (soft delete) an existing HubDB table. This archives both the published and draft versions.
118 119 120 121 122 123 124 125 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 118 def delete(table_id_or_name, params = {}) @client.request( method: :delete, path: ["cms/hubdb/2026-03/tables/%1$s", table_id_or_name], model: NilClass, options: params[:request_options] ) end |
#delete_version(version_id, table_id_or_name:, request_options: {}) ⇒ nil
Delete a specific version of a table
170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 170 def delete_version(version_id, params) parsed, = HubSpotSDK::Cms::Hubdb::TableDeleteVersionParams.dump_request(params) table_id_or_name = parsed.delete(:table_id_or_name) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["cms/hubdb/2026-03/tables/%1$s/versions/%2$s", table_id_or_name, version_id], model: NilClass, options: ) end |
#export(table_id_or_name, format_: nil, request_options: {}) ⇒ StringIO
Exports the published version of a table in a specified format.
195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 195 def export(table_id_or_name, params = {}) parsed, = HubSpotSDK::Cms::Hubdb::TableExportParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["cms/hubdb/2026-03/tables/%1$s/export", table_id_or_name], query: query.transform_keys(format_: "format"), headers: {"accept" => "application/vnd.ms-excel"}, model: StringIO, options: ) end |
#export_draft(table_id_or_name, format_: nil, request_options: {}) ⇒ StringIO
Exports the draft version of a table to CSV / EXCEL format.
219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 219 def export_draft(table_id_or_name, params = {}) parsed, = HubSpotSDK::Cms::Hubdb::TableExportDraftParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["cms/hubdb/2026-03/tables/%1$s/draft/export", table_id_or_name], query: query.transform_keys(format_: "format"), headers: {"accept" => "application/vnd.ms-excel"}, model: StringIO, options: ) end |
#get(table_id_or_name, archived: nil, include_foreign_ids: nil, is_get_localized_schema: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Returns the details for the published version of the specified table. This will include the definitions for the columns in the table and the number of rows in the table.
Note: This endpoint can be accessed without any authentication if the table is set to be allowed for public access. To do so, you’ll need to include the HubSpot account ID in a ‘portalId` query parameter.
255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 255 def get(table_id_or_name, params = {}) parsed, = HubSpotSDK::Cms::Hubdb::TableGetParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["cms/hubdb/2026-03/tables/%1$s", table_id_or_name], query: query.transform_keys( include_foreign_ids: "includeForeignIds", is_get_localized_schema: "isGetLocalizedSchema" ), model: HubSpotSDK::Cms::HubDBTableV3, options: ) end |
#get_draft(table_id_or_name, archived: nil, include_foreign_ids: nil, is_get_localized_schema: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Get the details for the draft version of a specific HubDB table. This will include the definitions for the columns in the table and the number of rows in the table.
289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 289 def get_draft(table_id_or_name, params = {}) parsed, = HubSpotSDK::Cms::Hubdb::TableGetDraftParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["cms/hubdb/2026-03/tables/%1$s/draft", table_id_or_name], query: query.transform_keys( include_foreign_ids: "includeForeignIds", is_get_localized_schema: "isGetLocalizedSchema" ), model: HubSpotSDK::Cms::HubDBTableV3, options: ) end |
#import_draft(table_id_or_name, config: nil, file: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::ImportResult
Import the contents of a CSV file into an existing HubDB table. The data will always be imported into the draft version of the table. Use the ‘/publish` endpoint to push these changes to the published version. This endpoint takes a multi-part POST request. The first part will be a set of JSON-formatted options for the import and you can specify this with the name as `config`. The second part will be the CSV file you want to import and you can specify this with the name as `file`. Refer the [overview section](developers.hubspot.com/docs/api/cms/hubdb#importing-tables) to check the details and format of the JSON-formatted options for the import.
324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 324 def import_draft(table_id_or_name, params = {}) parsed, = HubSpotSDK::Cms::Hubdb::TableImportDraftParams.dump_request(params) @client.request( method: :post, path: ["cms/hubdb/2026-03/tables/%1$s/draft/import", table_id_or_name], headers: {"content-type" => "multipart/form-data"}, body: parsed, model: HubSpotSDK::Cms::ImportResult, options: ) end |
#list(after: nil, archived: nil, content_type: nil, created_after: nil, created_at: nil, created_before: nil, is_get_localized_schema: nil, limit: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Cms::HubDBTableV3>
Some parameter documentations has been truncated, see Models::Cms::Hubdb::TableListParams for more details.
Returns the details for the published version of each table defined in an account, including column definitions.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 85 def list(params = {}) parsed, = HubSpotSDK::Cms::Hubdb::TableListParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "cms/hubdb/2026-03/tables", query: query.transform_keys( content_type: "contentType", created_after: "createdAfter", created_at: "createdAt", created_before: "createdBefore", is_get_localized_schema: "isGetLocalizedSchema", updated_after: "updatedAfter", updated_at: "updatedAt", updated_before: "updatedBefore" ), page: HubSpotSDK::Internal::Page, model: HubSpotSDK::Cms::HubDBTableV3, options: ) end |
#list_draft(after: nil, archived: nil, content_type: nil, created_after: nil, created_at: nil, created_before: nil, is_get_localized_schema: nil, limit: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Cms::HubDBTableV3>
Some parameter documentations has been truncated, see Models::Cms::Hubdb::TableListDraftParams for more details.
Returns the details for each draft table defined in the specified account, including column definitions.
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 373 def list_draft(params = {}) parsed, = HubSpotSDK::Cms::Hubdb::TableListDraftParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "cms/hubdb/2026-03/tables/draft", query: query.transform_keys( content_type: "contentType", created_after: "createdAfter", created_at: "createdAt", created_before: "createdBefore", is_get_localized_schema: "isGetLocalizedSchema", updated_after: "updatedAfter", updated_at: "updatedAt", updated_before: "updatedBefore" ), page: HubSpotSDK::Internal::Page, model: HubSpotSDK::Cms::HubDBTableV3, options: ) end |
#publish_draft(table_id_or_name, include_foreign_ids: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Publishes the table by copying the data and table schema changes from draft version to the published version, meaning any website pages using data from the table will be updated.
408 409 410 411 412 413 414 415 416 417 418 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 408 def publish_draft(table_id_or_name, params = {}) parsed, = HubSpotSDK::Cms::Hubdb::TablePublishDraftParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :post, path: ["cms/hubdb/2026-03/tables/%1$s/draft/publish", table_id_or_name], query: query.transform_keys(include_foreign_ids: "includeForeignIds"), model: HubSpotSDK::Cms::HubDBTableV3, options: ) end |
#reset_draft(table_id_or_name, include_foreign_ids: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Replaces the data in the draft version of the table with values from the published version. Any unpublished changes in the draft will be lost after this call is made.
433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 433 def reset_draft(table_id_or_name, params = {}) parsed, = HubSpotSDK::Cms::Hubdb::TableResetDraftParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :post, path: ["cms/hubdb/2026-03/tables/%1$s/draft/reset", table_id_or_name], query: query.transform_keys(include_foreign_ids: "includeForeignIds"), model: HubSpotSDK::Cms::HubDBTableV3, options: ) end |
#unpublish(table_id_or_name, include_foreign_ids: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Unpublishes the table, meaning any website pages using data from the table will not render any data.
457 458 459 460 461 462 463 464 465 466 467 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 457 def unpublish(table_id_or_name, params = {}) parsed, = HubSpotSDK::Cms::Hubdb::TableUnpublishParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :post, path: ["cms/hubdb/2026-03/tables/%1$s/unpublish", table_id_or_name], query: query.transform_keys(include_foreign_ids: "includeForeignIds"), model: HubSpotSDK::Cms::HubDBTableV3, options: ) end |
#update_draft(table_id_or_name, allow_child_tables:, allow_public_api_access:, columns:, dynamic_meta_tags:, enable_child_table_pages:, label:, name:, use_for_pages:, archived: nil, include_foreign_ids: nil, is_get_localized_schema: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::HubDBTableV3
Some parameter documentations has been truncated, see Models::Cms::Hubdb::TableUpdateDraftParams for more details.
Update an existing HubDB table. You can use this endpoint to add or remove columns to the table as well as restore an archived table. Tables updated using the endpoint will only modify the draft verion of the table. Use the ‘/publish` endpoint to push all the changes to the published version. To restore a table, include the query parameter `archived=true` and `“archived”: false` in the json body. Note: You need to include all the columns in the input when you are adding/removing/updating a column. If you do not include an already existing column in the request, it will be deleted.
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
# File 'lib/hubspot_sdk/resources/cms/hubdb/tables.rb', line 512 def update_draft(table_id_or_name, params) query_params = [:archived, :include_foreign_ids, :is_get_localized_schema] parsed, = HubSpotSDK::Cms::Hubdb::TableUpdateDraftParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :patch, path: ["cms/hubdb/2026-03/tables/%1$s/draft", table_id_or_name], query: query.transform_keys( include_foreign_ids: "includeForeignIds", is_get_localized_schema: "isGetLocalizedSchema" ), body: parsed.except(*query_params), model: HubSpotSDK::Cms::HubDBTableV3, options: ) end |