Class: HubSpotSDK::Resources::Cms::URLMappings

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/cms/url_mappings.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ URLMappings

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

Parameters:



154
155
156
# File 'lib/hubspot_sdk/resources/cms/url_mappings.rb', line 154

def initialize(client:)
  @client = client
end

Instance Method Details

#create(id:, cdn_purge_embargo_time:, content_group_id:, cos_object_type:, created:, created_by_id:, deleted_at:, destination:, internally_created:, is_active:, is_match_full_url:, is_match_query_string:, is_only_after_not_found:, is_pattern:, is_protocol_agnostic:, is_regex:, is_trailing_slash_optional:, label:, name:, note:, portal_id:, precedence:, redirect_style:, route_prefix:, updated:, updated_by_id:, request_options: {}) ⇒ StringIO

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

Create a new URL mapping in your HubSpot account. This endpoint allows you to define URL redirections and mappings, which can be useful for managing site navigation and SEO. The request body must include all required properties of the UrlMapping schema.

Parameters:

  • id (Integer)

    The unique identifier for the URL mapping, represented as a 64-bit integer.

  • cdn_purge_embargo_time (Integer)

    A Unix timestamp in milliseconds indicating the embargo time for CDN purge relat

  • content_group_id (Integer)

    A 64-bit integer representing the content group associated with the URL mapping.

  • cos_object_type (Symbol, HubSpotSDK::Models::Cms::URLMappingsURLMapping::CosObjectType)

    A string representing the type of content object associated with the URL mapping

  • created (Integer)

    A Unix timestamp in milliseconds indicating when the URL mapping was created.

  • created_by_id (Integer)

    The identifier of the user who created the URL mapping.

  • deleted_at (Integer)

    A Unix timestamp in milliseconds indicating when the URL mapping was deleted.

  • destination (String)

    The destination URL to which the routePrefix is redirected.

  • internally_created (Boolean)

    A boolean indicating if the URL mapping was created internally by the system.

  • is_active (Boolean)

    A boolean indicating if the URL mapping is currently active.

  • is_match_full_url (Boolean)

    A boolean indicating if the full URL should be matched.

  • is_match_query_string (Boolean)

    A boolean indicating if the query string should be matched.

  • is_only_after_not_found (Boolean)

    A boolean indicating if the mapping should only be applied after a 404 Not Found

  • is_pattern (Boolean)

    A boolean indicating if the routePrefix is a pattern.

  • is_protocol_agnostic (Boolean)

    A boolean indicating if the mapping should ignore the URL protocol (http/https).

  • is_regex (Boolean)

    A boolean indicating if the routePrefix should be treated as a regular expressio

  • is_trailing_slash_optional (Boolean)

    A boolean indicating if the trailing slash in the URL is optional.

  • label (String)

    A label for the URL mapping.

  • name (String)

    The name of the URL mapping.

  • note (String)

    A string containing notes about the URL mapping.

  • portal_id (Integer)

    The identifier for the HubSpot portal associated with this URL mapping.

  • precedence (Integer)

    An integer representing the precedence of the URL mapping, used to determine ord

  • redirect_style (Integer)

    An integer representing the style of redirection used.

  • route_prefix (String)

    The prefix of the URL path that is being mapped.

  • updated (Integer)

    A Unix timestamp in milliseconds indicating when the URL mapping was last update

  • updated_by_id (Integer)

    The identifier of the user who last updated the URL mapping.

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

Returns:

  • (StringIO)

See Also:



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/hubspot_sdk/resources/cms/url_mappings.rb', line 74

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

#delete(id, request_options: {}) ⇒ nil

Delete a specific URL mapping in your HubSpot account using its unique identifier. This operation will remove the URL mapping permanently, and it requires appropriate write and delete permissions.

Parameters:

Returns:

  • (nil)

See Also:



120
121
122
123
124
125
126
127
# File 'lib/hubspot_sdk/resources/cms/url_mappings.rb', line 120

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["url-mappings/2026-03/url-mappings/%1$s", id],
    model: NilClass,
    options: params[:request_options]
  )
end

#get(id, request_options: {}) ⇒ StringIO

Retrieve a specific URL mapping by its unique identifier. This endpoint is useful for obtaining details about a particular URL mapping configuration within your HubSpot account. It requires the ID of the URL mapping as a path parameter.

Parameters:

Returns:

  • (StringIO)

See Also:



141
142
143
144
145
146
147
148
149
# File 'lib/hubspot_sdk/resources/cms/url_mappings.rb', line 141

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

#list(request_options: {}) ⇒ StringIO

Retrieve a list of URL mappings from the HubSpot account. This endpoint provides access to URL mapping configurations, which can be used to manage and redirect URLs within the HubSpot CMS. It is useful for understanding how URLs are structured and redirected in your content management setup.

Parameters:

Returns:

  • (StringIO)

See Also:



98
99
100
101
102
103
104
105
106
# File 'lib/hubspot_sdk/resources/cms/url_mappings.rb', line 98

def list(params = {})
  @client.request(
    method: :get,
    path: "url-mappings/2026-03/url-mappings",
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: params[:request_options]
  )
end