Class: HubSpotSDK::Resources::Cms::Blogs::Posts

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/cms/blogs/posts.rb,
lib/hubspot_sdk/resources/cms/blogs/posts/batch.rb,
lib/hubspot_sdk/resources/cms/blogs/posts/revisions.rb,
lib/hubspot_sdk/resources/cms/blogs/posts/multi_language.rb

Defined Under Namespace

Classes: Batch, MultiLanguage, Revisions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Posts

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 Posts.

Parameters:



944
945
946
947
948
949
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 944

def initialize(client:)
  @client = client
  @batch = HubSpotSDK::Resources::Cms::Blogs::Posts::Batch.new(client: client)
  @multi_language = HubSpotSDK::Resources::Cms::Blogs::Posts::MultiLanguage.new(client: client)
  @revisions = HubSpotSDK::Resources::Cms::Blogs::Posts::Revisions.new(client: client)
end

Instance Attribute Details

#batchHubSpotSDK::Resources::Cms::Blogs::Posts::Batch (readonly)



9
10
11
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 9

def batch
  @batch
end

#multi_languageHubSpotSDK::Resources::Cms::Blogs::Posts::MultiLanguage (readonly)



12
13
14
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 12

def multi_language
  @multi_language
end

#revisionsHubSpotSDK::Resources::Cms::Blogs::Posts::Revisions (readonly)



15
16
17
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 15

def revisions
  @revisions
end

Instance Method Details

#clone_(id:, clone_name: nil, request_options: {}) ⇒ StringIO

Clone a blog post, making a copy of it in a new blog post.

Parameters:

  • id (String)

    ID of the object to be cloned.

  • clone_name (String)

    Name of the cloned object.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



407
408
409
410
411
412
413
414
415
416
417
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 407

def clone_(params)
  parsed, options = HubSpotSDK::Cms::Blogs::PostCloneParams.dump_request(params)
  @client.request(
    method: :post,
    path: "cms/blogs/2026-03/posts/clone",
    headers: {"content-type" => "*/*", "accept" => "*/*"},
    body: parsed,
    model: StringIO,
    options: options
  )
end

#create(id:, ab_status:, ab_test_id:, archived_at:, archived_in_dashboard:, attached_stylesheets:, author_name:, blog_author_id:, campaign:, category_id:, content_group_id:, content_type_category:, created:, created_by_id:, currently_published:, current_state:, domain:, dynamic_page_data_source_id:, dynamic_page_data_source_type:, dynamic_page_hub_db_table_id:, enable_domain_stylesheets:, enable_google_amp_output_override:, enable_layout_stylesheets:, featured_image:, featured_image_alt_text:, folder_id:, footer_html:, head_html:, html_title:, include_default_custom_css:, language:, layout_sections:, link_rel_canonical_url:, mab_experiment_id:, meta_description:, name:, page_expiry_date:, page_expiry_enabled:, page_expiry_redirect_id:, page_expiry_redirect_url:, password:, post_body:, post_summary:, public_access_rules:, public_access_rules_enabled:, publish_date:, publish_immediately:, rss_body:, rss_summary:, slug:, state:, tag_ids:, theme_settings_values:, translated_from_id:, translations:, updated:, updated_by_id:, url:, use_featured_image:, widget_containers:, widgets:, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::Cms::Blogs::PostCreateParams for more details.

Create a new blog post, specifying its content in the request body.

Parameters:

  • id (String)

    The unique ID of the Blog Post.

  • ab_status (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::AbStatus)

    The status of the AB test associated with this blog post, if applicable

  • ab_test_id (String)

    The ID of the AB test associated with this page, if applicable

  • archived_at (Integer)

    The timestamp (ISO8601 format) when this Blog Post was deleted.

  • archived_in_dashboard (Boolean)

    If True, the post will not show up in your dashboard, although the post could st

  • attached_stylesheets (Array<Hash{Symbol=>Object}>)

    List of stylesheets to attach to this blog post. These stylesheets are attached

  • author_name (String)

    The name of the user that updated this Blog Post.

  • blog_author_id (String)

    The ID of the Blog Author associated with this Blog Post.

  • campaign (String)

    The GUID of the marketing campaign this Blog Post is a part of.

  • category_id (Integer)

    ID of the type of object this is. Should always .

  • content_group_id (String)

    The ID of the parent Blog this Blog Post is associated with.

  • content_type_category (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::ContentTypeCategory)

    An ENUM descibing the type of this object. Should always be BLOG_POST.

  • created (Time)

    The timestamp (ISO8601 format) when this Blog Post was created.

  • created_by_id (String)

    The ID of the user that created this Blog Post.

  • currently_published (Boolean)

    Whether the post is published (true or false)

  • current_state (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::CurrentState)

    A generated ENUM descibing the current state of this Blog Post. Should always ma

  • domain (String)

    The domain this Blog Post will resolve to. If null, the Blog Post will default t

  • dynamic_page_data_source_id (String)

    The identifier for the data source used by the dynamic page.

  • dynamic_page_data_source_type (Integer)

    The type of data source used by the dynamic page.

  • dynamic_page_hub_db_table_id (String)

    The ID of the HubDB table this Blog Post references, if applicable

  • enable_domain_stylesheets (Boolean)

    Boolean to determine whether or not the styles from the template should be appli

  • enable_google_amp_output_override (Boolean)

    Boolean to allow overriding the AMP settings for the blog.

  • enable_layout_stylesheets (Boolean)

    Boolean to determine whether or not the styles from the template should be appli

  • featured_image (String)

    The featuredImage of this Blog Post.

  • featured_image_alt_text (String)

    Alt Text of the featuredImage.

  • folder_id (String)

    Unique identifier of associated folder

  • footer_html (String)

    Custom HTML for embed codes, javascript that should be placed before the </body>

  • head_html (String)

    Custom HTML for embed codes, javascript, etc. that goes in the <head> tag of the

  • html_title (String)

    The html title of this Blog Post.

  • include_default_custom_css (Boolean)

    Boolean to determine whether or not the Primary CSS Files should be applied.

  • language (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::Language)

    The explicitly defined ISO 639 language code of the Blog Post. If null, the Blog

  • layout_sections (Hash{Symbol=>HubSpotSDK::Models::Cms::LayoutSection})

    A structure detailing the layout sections of the blog post.

  • link_rel_canonical_url (String)

    Optional override to set the URL to be used in the rel=canonical link tag on the

  • mab_experiment_id (String)

    Unique identifier of the MAB Experiment

  • meta_description (String)

    A description that goes in <meta> tag on the page.

  • name (String)

    The internal name of the Blog Post.

  • page_expiry_date (Integer)

    The date at which this blog post should expire and begin redirecting to another

  • page_expiry_enabled (Boolean)

    Boolean describing if the page expiration feature is enabled for this blog post.

  • page_expiry_redirect_id (Integer)

    The ID of another page this blog post’s url should redirect to once this blog po

  • page_expiry_redirect_url (String)

    The URL this blog post’s url should redirect to once it expires. Should only set

  • password (String)

    Set this to create a password protected page. Entering the password will be requ

  • post_body (String)

    The HTML of the main post body.

  • post_summary (String)

    The summary of the blog post that will appear on the main listing page.

  • public_access_rules (Array<Object>)

    Rules for require member registration to access private content.

  • public_access_rules_enabled (Boolean)

    Boolean to determine whether or not to respect publicAccessRules.

  • publish_date (Time)

    The date (ISO8601 format) the blog post is to be published at.

  • publish_immediately (Boolean)

    Set this to true if you want to be published immediately when the schedule publi

  • rss_body (String)

    The contents of the RSS body for this Blog Post.

  • rss_summary (String)

    The contents of the RSS summary for this Blog Post.

  • slug (String)

    The path of the this blog post. This field is appended to the domain to construc

  • state (String)

    An ENUM descibing the current state of this Blog Post.

  • tag_ids (Array<Integer>)

    List of IDs for the tags associated with this Blog Post.

  • theme_settings_values (Hash{Symbol=>Object})

    A collection of settings specific to the theme applied to the blog post.

  • translated_from_id (String)

    ID of the primary blog post this object was translated from.

  • translations (Hash{Symbol=>HubSpotSDK::Models::Cms::ContentLanguageVariation})

    A map of translations for the blog post, each associated with a specific languag

  • updated (Time)

    The timestamp (ISO8601 format) when this Blog Post was updated.

  • updated_by_id (String)

    The ID of the user that updated this Blog Post.

  • url (String)

    A generated field representing the URL of this blog post.

  • use_featured_image (Boolean)

    Boolean to determine if this post should use a featuredImage.

  • widget_containers (Hash{Symbol=>Object})

    A data structure containing the data for all the modules inside the containers f

  • widgets (Hash{Symbol=>Object})

    A data structure containing the data for all the modules for this page.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



151
152
153
154
155
156
157
158
159
160
161
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 151

def create(params)
  parsed, options = HubSpotSDK::Cms::Blogs::PostCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "cms/blogs/2026-03/posts",
    headers: {"content-type" => "*/*", "accept" => "*/*"},
    body: parsed,
    model: StringIO,
    options: options
  )
end

#delete(object_id_, archived: nil, request_options: {}) ⇒ nil

Delete a blog post by ID.

Parameters:

  • object_id_ (String)
  • archived (Boolean)

    Whether to return only results that have been archived.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



382
383
384
385
386
387
388
389
390
391
392
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 382

def delete(object_id_, params = {})
  parsed, options = HubSpotSDK::Cms::Blogs::PostDeleteParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :delete,
    path: ["cms/blogs/2026-03/posts/%1$s", object_id_],
    query: query,
    model: NilClass,
    options: options
  )
end

#get(object_id_, archived: nil, property: nil, request_options: {}) ⇒ StringIO

Retrieve a blog post by the post ID.

Parameters:

  • object_id_ (String)
  • archived (Boolean)

    Whether to return only results that have been archived.

  • property (String)
  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



434
435
436
437
438
439
440
441
442
443
444
445
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 434

def get(object_id_, params = {})
  parsed, options = HubSpotSDK::Cms::Blogs::PostGetParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["cms/blogs/2026-03/posts/%1$s", object_id_],
    query: query,
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: options
  )
end

#get_draft_by_id(object_id_, request_options: {}) ⇒ StringIO

Retrieve the full draft version of a blog post.

Parameters:

Returns:

  • (StringIO)

See Also:



457
458
459
460
461
462
463
464
465
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 457

def get_draft_by_id(object_id_, params = {})
  @client.request(
    method: :get,
    path: ["cms/blogs/2026-03/posts/%1$s/draft", object_id_],
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: params[:request_options]
  )
end

#list(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::Cms::Blogs::PostListParams for more details.

Parameters:

  • after (String)

    The paging cursor token of the last successfully read resource will be returned

  • archived (Boolean)

    Whether to return only results that have been archived.

  • created_after (Time)
  • created_at (Time)
  • created_before (Time)
  • limit (Integer)

    The maximum number of results to display per page.

  • property (String)
  • sort (Array<String>)
  • updated_after (Time)
  • updated_at (Time)
  • updated_before (Time)
  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 349

def list(params = {})
  parsed, options = HubSpotSDK::Cms::Blogs::PostListParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "cms/blogs/2026-03/posts/cursor",
    query: query.transform_keys(
      created_after: "createdAfter",
      created_at: "createdAt",
      created_before: "createdBefore",
      updated_after: "updatedAfter",
      updated_at: "updatedAt",
      updated_before: "updatedBefore"
    ),
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: options
  )
end

#list_authors(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::Cms::Blogs::PostListAuthorsParams for more details.

Parameters:

  • after (String)

    The paging cursor token of the last successfully read resource will be returned

  • archived (Boolean)

    Whether to return only results that have been archived.

  • created_after (Time)
  • created_at (Time)
  • created_before (Time)
  • limit (Integer)

    The maximum number of results to display per page.

  • property (String)
  • sort (Array<String>)
  • updated_after (Time)
  • updated_at (Time)
  • updated_before (Time)
  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 499

def list_authors(params = {})
  parsed, options = HubSpotSDK::Cms::Blogs::PostListAuthorsParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "cms/blogs/2026-03/authors/cursor",
    query: query.transform_keys(
      created_after: "createdAfter",
      created_at: "createdAt",
      created_before: "createdBefore",
      updated_after: "updatedAfter",
      updated_at: "updatedAt",
      updated_before: "updatedBefore"
    ),
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: options
  )
end

#list_tags(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::Cms::Blogs::PostListTagsParams for more details.

Parameters:

  • after (String)

    The paging cursor token of the last successfully read resource will be returned

  • archived (Boolean)

    Whether to return only results that have been archived.

  • created_after (Time)
  • created_at (Time)
  • created_before (Time)
  • limit (Integer)

    The maximum number of results to display per page.

  • property (String)
  • sort (Array<String>)
  • updated_after (Time)
  • updated_at (Time)
  • updated_before (Time)
  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 551

def list_tags(params = {})
  parsed, options = HubSpotSDK::Cms::Blogs::PostListTagsParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "cms/blogs/2026-03/tags/cursor",
    query: query.transform_keys(
      created_after: "createdAfter",
      created_at: "createdAt",
      created_before: "createdBefore",
      updated_after: "updatedAfter",
      updated_at: "updatedAt",
      updated_before: "updatedBefore"
    ),
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: options
  )
end

#push_live(object_id_, request_options: {}) ⇒ nil

Publish the draft version of the blog post, sending its content to the live page.

Parameters:

Returns:

  • (nil)

See Also:



582
583
584
585
586
587
588
589
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 582

def push_live(object_id_, params = {})
  @client.request(
    method: :post,
    path: ["cms/blogs/2026-03/posts/%1$s/draft/push-live", object_id_],
    model: NilClass,
    options: params[:request_options]
  )
end

#query(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::Cms::Blogs::PostQueryParams for more details.

Parameters:

  • after (String)

    The paging cursor token of the last successfully read resource will be returned

  • archived (Boolean)

    Whether to return only results that have been archived.

  • created_after (Time)
  • created_at (Time)
  • created_before (Time)
  • limit (Integer)

    The maximum number of results to display per page.

  • property (String)
  • sort (Array<String>)
  • updated_after (Time)
  • updated_at (Time)
  • updated_before (Time)
  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 623

def query(params = {})
  parsed, options = HubSpotSDK::Cms::Blogs::PostQueryParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "cms/blogs/2026-03/posts/cursor/query",
    query: query.transform_keys(
      created_after: "createdAfter",
      created_at: "createdAt",
      created_before: "createdBefore",
      updated_after: "updatedAfter",
      updated_at: "updatedAt",
      updated_before: "updatedBefore"
    ),
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: options
  )
end

#query_authors(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::Cms::Blogs::PostQueryAuthorsParams for more details.

Parameters:

  • after (String)

    The paging cursor token of the last successfully read resource will be returned

  • archived (Boolean)

    Whether to return only results that have been archived.

  • created_after (Time)
  • created_at (Time)
  • created_before (Time)
  • limit (Integer)

    The maximum number of results to display per page.

  • property (String)
  • sort (Array<String>)
  • updated_after (Time)
  • updated_at (Time)
  • updated_before (Time)
  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 675

def query_authors(params = {})
  parsed, options = HubSpotSDK::Cms::Blogs::PostQueryAuthorsParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "cms/blogs/2026-03/authors/cursor/query",
    query: query.transform_keys(
      created_after: "createdAfter",
      created_at: "createdAt",
      created_before: "createdBefore",
      updated_after: "updatedAfter",
      updated_at: "updatedAt",
      updated_before: "updatedBefore"
    ),
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: options
  )
end

#query_tags(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::Cms::Blogs::PostQueryTagsParams for more details.

Parameters:

  • after (String)

    The paging cursor token of the last successfully read resource will be returned

  • archived (Boolean)

    Whether to return only results that have been archived.

  • created_after (Time)
  • created_at (Time)
  • created_before (Time)
  • limit (Integer)

    The maximum number of results to display per page.

  • property (String)
  • sort (Array<String>)
  • updated_after (Time)
  • updated_at (Time)
  • updated_before (Time)
  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 727

def query_tags(params = {})
  parsed, options = HubSpotSDK::Cms::Blogs::PostQueryTagsParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "cms/blogs/2026-03/tags/cursor/query",
    query: query.transform_keys(
      created_after: "createdAfter",
      created_at: "createdAt",
      created_before: "createdBefore",
      updated_after: "updatedAfter",
      updated_at: "updatedAt",
      updated_before: "updatedBefore"
    ),
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: options
  )
end

#reset_draft(object_id_, request_options: {}) ⇒ nil

Discard all drafted content, resetting the draft to contain the content in the currently published version.

Parameters:

Returns:

  • (nil)

See Also:



758
759
760
761
762
763
764
765
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 758

def reset_draft(object_id_, params = {})
  @client.request(
    method: :post,
    path: ["cms/blogs/2026-03/posts/%1$s/draft/reset", object_id_],
    model: NilClass,
    options: params[:request_options]
  )
end

#schedule(id:, publish_date:, request_options: {}) ⇒ nil

Schedule a blog post to be published at a specified time.

Parameters:

  • id (String)

    The ID of the object to be scheduled.

  • publish_date (Time)

    The date the object should transition from scheduled to published.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



780
781
782
783
784
785
786
787
788
789
790
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 780

def schedule(params)
  parsed, options = HubSpotSDK::Cms::Blogs::PostScheduleParams.dump_request(params)
  @client.request(
    method: :post,
    path: "cms/blogs/2026-03/posts/schedule",
    headers: {"content-type" => "*/*"},
    body: parsed,
    model: NilClass,
    options: options
  )
end

#update(object_id_, id:, ab_status:, ab_test_id:, archived_at:, archived_in_dashboard:, attached_stylesheets:, author_name:, blog_author_id:, campaign:, category_id:, content_group_id:, content_type_category:, created:, created_by_id:, currently_published:, current_state:, domain:, dynamic_page_data_source_id:, dynamic_page_data_source_type:, dynamic_page_hub_db_table_id:, enable_domain_stylesheets:, enable_google_amp_output_override:, enable_layout_stylesheets:, featured_image:, featured_image_alt_text:, folder_id:, footer_html:, head_html:, html_title:, include_default_custom_css:, language:, layout_sections:, link_rel_canonical_url:, mab_experiment_id:, meta_description:, name:, page_expiry_date:, page_expiry_enabled:, page_expiry_redirect_id:, page_expiry_redirect_url:, password:, post_body:, post_summary:, public_access_rules:, public_access_rules_enabled:, publish_date:, publish_immediately:, rss_body:, rss_summary:, slug:, state:, tag_ids:, theme_settings_values:, translated_from_id:, translations:, updated:, updated_by_id:, url:, use_featured_image:, widget_containers:, widgets:, archived: nil, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::Cms::Blogs::PostUpdateParams for more details.

Partially updates a single blog post by ID. You only need to specify the values that you want to update.

Parameters:

  • object_id_ (String)

    Path param

  • id (String)

    Body param: The unique ID of the Blog Post.

  • ab_status (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::AbStatus)

    Body param: The status of the AB test associated with this blog post, if applica

  • ab_test_id (String)

    Body param: The ID of the AB test associated with this page, if applicable

  • archived_at (Integer)

    Body param: The timestamp (ISO8601 format) when this Blog Post was deleted.

  • archived_in_dashboard (Boolean)

    Body param: If True, the post will not show up in your dashboard, although the p

  • attached_stylesheets (Array<Hash{Symbol=>Object}>)

    Body param: List of stylesheets to attach to this blog post. These stylesheets a

  • author_name (String)

    Body param: The name of the user that updated this Blog Post.

  • blog_author_id (String)

    Body param: The ID of the Blog Author associated with this Blog Post.

  • campaign (String)

    Body param: The GUID of the marketing campaign this Blog Post is a part of.

  • category_id (Integer)

    Body param: ID of the type of object this is. Should always .

  • content_group_id (String)

    Body param: The ID of the parent Blog this Blog Post is associated with.

  • content_type_category (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::ContentTypeCategory)

    Body param: An ENUM descibing the type of this object. Should always be BLOG_POS

  • created (Time)

    Body param: The timestamp (ISO8601 format) when this Blog Post was created.

  • created_by_id (String)

    Body param: The ID of the user that created this Blog Post.

  • currently_published (Boolean)

    Body param: Whether the post is published (true or false)

  • current_state (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::CurrentState)

    Body param: A generated ENUM descibing the current state of this Blog Post. Shou

  • domain (String)

    Body param: The domain this Blog Post will resolve to. If null, the Blog Post wi

  • dynamic_page_data_source_id (String)

    Body param: The identifier for the data source used by the dynamic page.

  • dynamic_page_data_source_type (Integer)

    Body param: The type of data source used by the dynamic page.

  • dynamic_page_hub_db_table_id (String)

    Body param: The ID of the HubDB table this Blog Post references, if applicable

  • enable_domain_stylesheets (Boolean)

    Body param: Boolean to determine whether or not the styles from the template sho

  • enable_google_amp_output_override (Boolean)

    Body param: Boolean to allow overriding the AMP settings for the blog.

  • enable_layout_stylesheets (Boolean)

    Body param: Boolean to determine whether or not the styles from the template sho

  • featured_image (String)

    Body param: The featuredImage of this Blog Post.

  • featured_image_alt_text (String)

    Body param: Alt Text of the featuredImage.

  • folder_id (String)

    Body param: Unique identifier of associated folder

  • footer_html (String)

    Body param: Custom HTML for embed codes, javascript that should be placed before

  • head_html (String)

    Body param: Custom HTML for embed codes, javascript, etc. that goes in the <head

  • html_title (String)

    Body param: The html title of this Blog Post.

  • include_default_custom_css (Boolean)

    Body param: Boolean to determine whether or not the Primary CSS Files should be

  • language (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::Language)

    Body param: The explicitly defined ISO 639 language code of the Blog Post. If nu

  • layout_sections (Hash{Symbol=>HubSpotSDK::Models::Cms::LayoutSection})

    Body param: A structure detailing the layout sections of the blog post.

  • link_rel_canonical_url (String)

    Body param: Optional override to set the URL to be used in the rel=canonical lin

  • mab_experiment_id (String)

    Body param: Unique identifier of the MAB Experiment

  • meta_description (String)

    Body param: A description that goes in <meta> tag on the page.

  • name (String)

    Body param: The internal name of the Blog Post.

  • page_expiry_date (Integer)

    Body param: The date at which this blog post should expire and begin redirecting

  • page_expiry_enabled (Boolean)

    Body param: Boolean describing if the page expiration feature is enabled for thi

  • page_expiry_redirect_id (Integer)

    Body param: The ID of another page this blog post’s url should redirect to once

  • page_expiry_redirect_url (String)

    Body param: The URL this blog post’s url should redirect to once it expires. Sho

  • password (String)

    Body param: Set this to create a password protected page. Entering the password

  • post_body (String)

    Body param: The HTML of the main post body.

  • post_summary (String)

    Body param: The summary of the blog post that will appear on the main listing pa

  • public_access_rules (Array<Object>)

    Body param: Rules for require member registration to access private content.

  • public_access_rules_enabled (Boolean)

    Body param: Boolean to determine whether or not to respect publicAccessRules.

  • publish_date (Time)

    Body param: The date (ISO8601 format) the blog post is to be published at.

  • publish_immediately (Boolean)

    Body param: Set this to true if you want to be published immediately when the sc

  • rss_body (String)

    Body param: The contents of the RSS body for this Blog Post.

  • rss_summary (String)

    Body param: The contents of the RSS summary for this Blog Post.

  • slug (String)

    Body param: The path of the this blog post. This field is appended to the domain

  • state (String)

    Body param: An ENUM descibing the current state of this Blog Post.

  • tag_ids (Array<Integer>)

    Body param: List of IDs for the tags associated with this Blog Post.

  • theme_settings_values (Hash{Symbol=>Object})

    Body param: A collection of settings specific to the theme applied to the blog p

  • translated_from_id (String)

    Body param: ID of the primary blog post this object was translated from.

  • translations (Hash{Symbol=>HubSpotSDK::Models::Cms::ContentLanguageVariation})

    Body param: A map of translations for the blog post, each associated with a spec

  • updated (Time)

    Body param: The timestamp (ISO8601 format) when this Blog Post was updated.

  • updated_by_id (String)

    Body param: The ID of the user that updated this Blog Post.

  • url (String)

    Body param: A generated field representing the URL of this blog post.

  • use_featured_image (Boolean)

    Body param: Boolean to determine if this post should use a featuredImage.

  • widget_containers (Hash{Symbol=>Object})

    Body param: A data structure containing the data for all the modules inside the

  • widgets (Hash{Symbol=>Object})

    Body param: A data structure containing the data for all the modules for this pa

  • archived (Boolean)

    Query param: Whether to return only results that have been archived.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 302

def update(object_id_, params)
  query_params = [:archived]
  parsed, options = HubSpotSDK::Cms::Blogs::PostUpdateParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :patch,
    path: ["cms/blogs/2026-03/posts/%1$s", object_id_],
    query: query,
    headers: {"content-type" => "*/*", "accept" => "*/*"},
    body: parsed.except(*query_params),
    model: StringIO,
    options: options
  )
end

#update_draft(object_id_, id:, ab_status:, ab_test_id:, archived_at:, archived_in_dashboard:, attached_stylesheets:, author_name:, blog_author_id:, campaign:, category_id:, content_group_id:, content_type_category:, created:, created_by_id:, currently_published:, current_state:, domain:, dynamic_page_data_source_id:, dynamic_page_data_source_type:, dynamic_page_hub_db_table_id:, enable_domain_stylesheets:, enable_google_amp_output_override:, enable_layout_stylesheets:, featured_image:, featured_image_alt_text:, folder_id:, footer_html:, head_html:, html_title:, include_default_custom_css:, language:, layout_sections:, link_rel_canonical_url:, mab_experiment_id:, meta_description:, name:, page_expiry_date:, page_expiry_enabled:, page_expiry_redirect_id:, page_expiry_redirect_url:, password:, post_body:, post_summary:, public_access_rules:, public_access_rules_enabled:, publish_date:, publish_immediately:, rss_body:, rss_summary:, slug:, state:, tag_ids:, theme_settings_values:, translated_from_id:, translations:, updated:, updated_by_id:, url:, use_featured_image:, widget_containers:, widgets:, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::Cms::Blogs::PostUpdateDraftParams for more details.

Partially updates the draft version of a single blog post by ID. You only need to specify the values that you want to update.

Parameters:

  • object_id_ (String)
  • id (String)

    The unique ID of the Blog Post.

  • ab_status (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::AbStatus)

    The status of the AB test associated with this blog post, if applicable

  • ab_test_id (String)

    The ID of the AB test associated with this page, if applicable

  • archived_at (Integer)

    The timestamp (ISO8601 format) when this Blog Post was deleted.

  • archived_in_dashboard (Boolean)

    If True, the post will not show up in your dashboard, although the post could st

  • attached_stylesheets (Array<Hash{Symbol=>Object}>)

    List of stylesheets to attach to this blog post. These stylesheets are attached

  • author_name (String)

    The name of the user that updated this Blog Post.

  • blog_author_id (String)

    The ID of the Blog Author associated with this Blog Post.

  • campaign (String)

    The GUID of the marketing campaign this Blog Post is a part of.

  • category_id (Integer)

    ID of the type of object this is. Should always .

  • content_group_id (String)

    The ID of the parent Blog this Blog Post is associated with.

  • content_type_category (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::ContentTypeCategory)

    An ENUM descibing the type of this object. Should always be BLOG_POST.

  • created (Time)

    The timestamp (ISO8601 format) when this Blog Post was created.

  • created_by_id (String)

    The ID of the user that created this Blog Post.

  • currently_published (Boolean)

    Whether the post is published (true or false)

  • current_state (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::CurrentState)

    A generated ENUM descibing the current state of this Blog Post. Should always ma

  • domain (String)

    The domain this Blog Post will resolve to. If null, the Blog Post will default t

  • dynamic_page_data_source_id (String)

    The identifier for the data source used by the dynamic page.

  • dynamic_page_data_source_type (Integer)

    The type of data source used by the dynamic page.

  • dynamic_page_hub_db_table_id (String)

    The ID of the HubDB table this Blog Post references, if applicable

  • enable_domain_stylesheets (Boolean)

    Boolean to determine whether or not the styles from the template should be appli

  • enable_google_amp_output_override (Boolean)

    Boolean to allow overriding the AMP settings for the blog.

  • enable_layout_stylesheets (Boolean)

    Boolean to determine whether or not the styles from the template should be appli

  • featured_image (String)

    The featuredImage of this Blog Post.

  • featured_image_alt_text (String)

    Alt Text of the featuredImage.

  • folder_id (String)

    Unique identifier of associated folder

  • footer_html (String)

    Custom HTML for embed codes, javascript that should be placed before the </body>

  • head_html (String)

    Custom HTML for embed codes, javascript, etc. that goes in the <head> tag of the

  • html_title (String)

    The html title of this Blog Post.

  • include_default_custom_css (Boolean)

    Boolean to determine whether or not the Primary CSS Files should be applied.

  • language (Symbol, HubSpotSDK::Models::Cms::Blogs::BlogPost::Language)

    The explicitly defined ISO 639 language code of the Blog Post. If null, the Blog

  • layout_sections (Hash{Symbol=>HubSpotSDK::Models::Cms::LayoutSection})

    A structure detailing the layout sections of the blog post.

  • link_rel_canonical_url (String)

    Optional override to set the URL to be used in the rel=canonical link tag on the

  • mab_experiment_id (String)

    Unique identifier of the MAB Experiment

  • meta_description (String)

    A description that goes in <meta> tag on the page.

  • name (String)

    The internal name of the Blog Post.

  • page_expiry_date (Integer)

    The date at which this blog post should expire and begin redirecting to another

  • page_expiry_enabled (Boolean)

    Boolean describing if the page expiration feature is enabled for this blog post.

  • page_expiry_redirect_id (Integer)

    The ID of another page this blog post’s url should redirect to once this blog po

  • page_expiry_redirect_url (String)

    The URL this blog post’s url should redirect to once it expires. Should only set

  • password (String)

    Set this to create a password protected page. Entering the password will be requ

  • post_body (String)

    The HTML of the main post body.

  • post_summary (String)

    The summary of the blog post that will appear on the main listing page.

  • public_access_rules (Array<Object>)

    Rules for require member registration to access private content.

  • public_access_rules_enabled (Boolean)

    Boolean to determine whether or not to respect publicAccessRules.

  • publish_date (Time)

    The date (ISO8601 format) the blog post is to be published at.

  • publish_immediately (Boolean)

    Set this to true if you want to be published immediately when the schedule publi

  • rss_body (String)

    The contents of the RSS body for this Blog Post.

  • rss_summary (String)

    The contents of the RSS summary for this Blog Post.

  • slug (String)

    The path of the this blog post. This field is appended to the domain to construc

  • state (String)

    An ENUM descibing the current state of this Blog Post.

  • tag_ids (Array<Integer>)

    List of IDs for the tags associated with this Blog Post.

  • theme_settings_values (Hash{Symbol=>Object})

    A collection of settings specific to the theme applied to the blog post.

  • translated_from_id (String)

    ID of the primary blog post this object was translated from.

  • translations (Hash{Symbol=>HubSpotSDK::Models::Cms::ContentLanguageVariation})

    A map of translations for the blog post, each associated with a specific languag

  • updated (Time)

    The timestamp (ISO8601 format) when this Blog Post was updated.

  • updated_by_id (String)

    The ID of the user that updated this Blog Post.

  • url (String)

    A generated field representing the URL of this blog post.

  • use_featured_image (Boolean)

    Boolean to determine if this post should use a featuredImage.

  • widget_containers (Hash{Symbol=>Object})

    A data structure containing the data for all the modules inside the containers f

  • widgets (Hash{Symbol=>Object})

    A data structure containing the data for all the modules for this page.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



929
930
931
932
933
934
935
936
937
938
939
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 929

def update_draft(object_id_, params)
  parsed, options = HubSpotSDK::Cms::Blogs::PostUpdateDraftParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["cms/blogs/2026-03/posts/%1$s/draft", object_id_],
    headers: {"content-type" => "*/*", "accept" => "*/*"},
    body: parsed,
    model: StringIO,
    options: options
  )
end