uploadAPI method

Future<VisualSearchUploadResponse?> uploadAPI(
  1. String widgetId,
  2. int accountId,
  3. String domainKey, {
  4. MultipartFile? image,
})

This API allows you to upload the image for Visual Search.

Parameters:

  • String widgetId (required): The ID of the widget, which can be found in the Widget Configurator in the Dashboard.

  • int accountId (required): Your site's numerical Bloomreach account ID. Your Bloomreach representative gives your site's account ID to you before or during your integration kickoff meeting.

  • String domainKey (required): Your site domain's ID, which Bloomreach provides during initial scoping and integration. This ID is for the domain that you want to receive your Bloomreach API requests. This parameter identifies the specific site version when the one account ID hosts multiple site versions with unique characteristics, such as language versions.

  • MultipartFile image:

Implementation

Future<VisualSearchUploadResponse?> uploadAPI(String widgetId, int accountId, String domainKey, { MultipartFile? image, }) async {
  final response = await uploadAPIWithHttpInfo(widgetId, accountId, domainKey,  image: image, );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'VisualSearchUploadResponse',) as VisualSearchUploadResponse;

  }
  return null;
}