Method: KlaviyoAPI::TemplatesApi#create_universal_content_with_http_info

Defined in:
lib/klaviyo-api-sdk/api/templates_api.rb

#create_universal_content_with_http_info(universal_content_create_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_template_universal_content_with_http_info

Create Universal Content Create universal content. Only text blocks, which can include text or HTML, are supported at this time.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;templates:write&#x60;

Parameters:

  • universal_content_create_query (UniversalContentCreateQuery)

    Create a template universal content

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/klaviyo-api-sdk/api/templates_api.rb', line 185

def create_universal_content_with_http_info(universal_content_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.create_universal_content ...'
  end
  # verify the required parameter 'universal_content_create_query' is set
  if @api_client.config.client_side_validation && universal_content_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'universal_content_create_query' when calling TemplatesApi.create_universal_content"
  end
  # resource path
  local_var_path = '/api/template-universal-content'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(universal_content_create_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"TemplatesApi.create_universal_content",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#create_universal_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end