Method: OpenapiClient::BatchesApi#list_batch_errors_with_http_info

Defined in:
lib/openapi_client/api/batches_api.rb

#list_batch_errors_with_http_info(batch_id, opts = {}) ⇒ Array<(ListBatchErrorsResponseBody, Integer, Hash)>

Get Batch Errors Error handling in batches are handled differently than in a single synchronous request. You must retrieve the status of your batch by [getting a batch](www.shipengine.com/docs/reference/get-batch-by-id/) and getting an overview of the statuses or you can list errors directly here below to get detailed information about the errors.

Parameters:

  • batch_id (String)

    Batch ID

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Return a specific page of results. Defaults to the first page. If set to a number that&#39;s greater than the number of pages of results, an empty page is returned.

  • :pagesize (Integer)

Returns:

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

    ListBatchErrorsResponseBody data, response status code and response headers



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/openapi_client/api/batches_api.rb', line 400

def list_batch_errors_with_http_info(batch_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BatchesApi.list_batch_errors ...'
  end
  # verify the required parameter 'batch_id' is set
  if @api_client.config.client_side_validation && batch_id.nil?
    fail ArgumentError, "Missing the required parameter 'batch_id' when calling BatchesApi.list_batch_errors"
  end
  if @api_client.config.client_side_validation && batch_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "batch_id" when calling BatchesApi.list_batch_errors, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && batch_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "batch_id" when calling BatchesApi.list_batch_errors, the character length must be great than or equal to 1.'
  end

  pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)
  if @api_client.config.client_side_validation && batch_id !~ pattern
    fail ArgumentError, "invalid value for 'batch_id' when calling BatchesApi.list_batch_errors, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling BatchesApi.list_batch_errors, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'pagesize'].nil? && opts[:'pagesize'] < 1
    fail ArgumentError, 'invalid value for "opts[:"pagesize"]" when calling BatchesApi.list_batch_errors, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/batches/{batch_id}/errors'.sub('{' + 'batch_id' + '}', CGI.escape(batch_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'pagesize'] = opts[:'pagesize'] if !opts[:'pagesize'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

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

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'ListBatchErrorsResponseBody' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = opts.merge(
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BatchesApi#list_batch_errors\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end