Amplify JS API Documentation
    Preparing search index...

    Function put

    • Parameters

      Returns PutOperation

    • PUT HTTP request

      Parameters

      • input: PutInput

        Input for PUT operation

      Returns PutOperation

      Operation for PUT request

      • RestApiError

      Send a PUT request

      import { put, isCancelError } from '@aws-amplify/api';

      const { body } = await put({
      apiName,
      path,
      options: {
      headers, // Optional, A map of custom header key/values
      body, // Optional, JSON object or FormData
      queryParams, // Optional, A map of query strings
      }
      }).response;
      const data = await body.json();

      Cancel a PUT request

      import { put, isCancelError } from '@aws-amplify/api';

      const { response, cancel } = put({apiName, path, options});
      cancel(message);
      try {
      await response;
      } catch (e) {
      if (isCancelError(e)) {
      // handle request cancellation
      }
      //...
      }