Amplify JS API Documentation
    Preparing search index...

    Function get

    • Parameters

      Returns GetOperation

    • GET HTTP request

      Parameters

      • input: GetInput

        Input for GET operation

      Returns GetOperation

      Operation for GET request

      • RestApiError

      Send a GET request

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

      const { body } = await get({
      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 GET request

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

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