Method: AmznSpApi::NotificationsApiModel::NotificationsApi#create_subscription_with_http_info

Defined in:
lib/notifications_api_model/api/notifications_api.rb

#create_subscription_with_http_info(body, notification_type, opts = {}) ⇒ Array<(CreateSubscriptionResponse, Integer, Hash)>

Creates a subscription for the specified notification type to be delivered to the specified destination. Before you can subscribe, you must first create the destination by calling the createDestination operation. **Usage Plan:** | Rate (requests per second) | Burst | | —- | —- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).

Parameters:

  • body
  • notification_type

    The type of notification. For more information about notification types, see [the Notifications API Use Case Guide](doc:notifications-api-v1-use-case-guide).

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

    the optional parameters

Returns:

  • (Array<(CreateSubscriptionResponse, Integer, Hash)>)

    CreateSubscriptionResponse data, response status code and response headers

Raises:

  • (ArgumentError)


85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/notifications_api_model/api/notifications_api.rb', line 85

def create_subscription_with_http_info(body, notification_type, opts = {})
  @api_client.config.logger.debug 'Calling API: NotificationsApi.create_subscription ...' if @api_client.config.debugging
  # verify the required parameter 'body' is set
  raise ArgumentError, "Missing the required parameter 'body' when calling NotificationsApi.create_subscription" if @api_client.config.client_side_validation && body.nil?
  # verify the required parameter 'notification_type' is set
  raise ArgumentError, "Missing the required parameter 'notification_type' when calling NotificationsApi.create_subscription" if @api_client.config.client_side_validation && notification_type.nil?

  # resource path
  local_var_path = '/notifications/v1/subscriptions/{notificationType}'.sub('{' + 'notificationType' + '}', notification_type.to_s)

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'Successful Response'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

  return_type = opts[:return_type] || 'CreateSubscriptionResponse'

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
                                                    header_params: header_params,
                                                    query_params: query_params,
                                                    form_params: form_params,
                                                    body: post_body,
                                                    auth_names: auth_names,
                                                    return_type: return_type)

  @api_client.config.logger.debug "API called: NotificationsApi#create_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
  [data, status_code, headers]
end