How to use the aws-amplify.API.get function in aws-amplify

To help you get started, we’ve selected a few aws-amplify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awslabs / aws-multi-account-viewer / Front-End / src / pages / AllODCR.js View on Github external
componentDidMount() {

        // API Gateway
        let apiName = 'MyAPIGatewayAPI';
        let querypath = '/search/?scan=odcr';

        // Loading 
        this.setState({ isLoading: true });

        // Scan DynamoDB for results
        API.get(apiName, querypath).then(response => {
            this.setState({
                instances: response,
                isLoading: false
            });
        })
            .then(response => {
                console.log(this.state.instances)
            })
            .catch(error => {
                this.setState({ error, isLoading: false })
                console.log(error.response)
            });
    }
    render() {
github aws-samples / connected-drink-dispenser-workshop / dispenser_app / src / components / Dispenser.vue View on Github external
requestDispense: function() {
      API.get("CDD_API", "/dispense", {
        queryStringParameters: {
          dispenserId: this.getDispenserId
        },
        responseType: "text"
      })
      .then(response => {
        this.lastApiMessage = response;
        console.log("Dispense command: ", response);
      })
      .catch(error => {
        console.log(error);
      });
    }
  },
github forgepwa / the_forge / yolo / public / my-project / src / API / Menu.jsx View on Github external
fetchMenuList = async () => {
        API.get('ReactSample','/items/restaurants/'+ sessionStorage.getItem('currentRestaurantId') + '/menu')
            .then(data => {
                console.log(data);
                this.setState({
                    myTableData: data
                });
                return data;
            })
            .catch ( err => console.log(err))
    }
github awslabs / media-analysis-solution / source / web_site / src / components / result.js View on Github external
componentDidMount() {
    var self = this;

    var path = ['/details',this.props.match.params.objectid].join('/');
    var requestParams = {};
    self.setState({
        downloading: true
    });
    API.get('MediaAnalysisApi', path, requestParams)
      .then(function(response) {

        var filepath = ['media',response.object_id,'content',response.details.filename].join('/');
        Storage.get(filepath,{level: 'private'})
        .then(function(file) {
          self.setState({
            downloading: false,
            media_file: file,
            error_status: false
          })
        })
        .catch(function(err) {
          //console.log(err);
        });

        self.setState({
github awslabs / media-analysis-solution / source / web_site / src / components / result.js View on Github external
getPhrases() {
    var self = this;
    var phrases_path = ['/lookup',this.props.match.params.objectid,'phrases'].join('/');
    var phrase_list = [];
    API.get('MediaAnalysisApi', phrases_path, {})
      .then(function(data) {
          for (var p in data.Phrases) {
              phrase_list.push({"Name":data.Phrases[p].Name, "Confidence":data.Phrases[p].Impressions[0].Score*100, "Id":[data.Phrases[p].Name.replace(/[^\w\s]|_/g, " ").replace(/\s+/g, " "),uuidv4()].join('-')});
          }
          self.setState({
              "phrase_list": phrase_list
          });
      })
      .catch(function(err) {
          //console.log(err);
      });
  }
github awslabs / aws-multi-account-viewer / Front-End / src / pages / Refresh.js View on Github external
this.setState({ isLoading: true }, () => {
        API.get(apiName, querypath).then(response => {
            this.setState({ isLoading: false });
            console.log('sent to sqs')
            alert('Successful')
        }).catch(error => {
            console.log(error.response)
            alert('Failed: ' + JSON.stringify(error.response.data))
        });
        });
      }
github aws-samples / aws-bookstore-demo-app / assets / src / modules / category / CategoryGallery.tsx View on Github external
listBooks() {
    return API.get("books", `/books?category=${this.props.match.params.id}`, null);
  }
github aws-samples / aws-bookstore-demo-app / assets / src / modules / pastPurchases / PurchasedProductRow.tsx View on Github external
getBook(order: Order) {
    return API.get("books", `/books/${order.bookId}`, null);
  }