Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-amplify/api-rest

Package Overview
Dependencies
Maintainers
0
Versions
1708
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-amplify/api-rest

Api-rest category of aws-amplify

  • 4.0.55
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
707K
decreased by-3.83%
Maintainers
0
Weekly downloads
 
Created

What is @aws-amplify/api-rest?

@aws-amplify/api-rest is a part of the AWS Amplify library that provides a simple and powerful way to interact with REST APIs. It allows developers to easily integrate their applications with AWS services and other RESTful endpoints.

What are @aws-amplify/api-rest's main functionalities?

GET Request

This feature allows you to make a GET request to a specified API endpoint. The code sample demonstrates how to fetch data from the '/items' endpoint of 'myApiName' API.

const apiName = 'myApiName';
const path = '/items';

API.get(apiName, path).then(response => {
  console.log(response);
}).catch(error => {
  console.error(error);
});

POST Request

This feature allows you to make a POST request to a specified API endpoint. The code sample demonstrates how to send data to the '/items' endpoint of 'myApiName' API.

const apiName = 'myApiName';
const path = '/items';
const myInit = {
  body: {
    itemName: 'NewItem'
  }
};

API.post(apiName, path, myInit).then(response => {
  console.log(response);
}).catch(error => {
  console.error(error);
});

PUT Request

This feature allows you to make a PUT request to a specified API endpoint. The code sample demonstrates how to update data at the '/items/1' endpoint of 'myApiName' API.

const apiName = 'myApiName';
const path = '/items/1';
const myInit = {
  body: {
    itemName: 'UpdatedItem'
  }
};

API.put(apiName, path, myInit).then(response => {
  console.log(response);
}).catch(error => {
  console.error(error);
});

DELETE Request

This feature allows you to make a DELETE request to a specified API endpoint. The code sample demonstrates how to delete data at the '/items/1' endpoint of 'myApiName' API.

const apiName = 'myApiName';
const path = '/items/1';

API.del(apiName, path).then(response => {
  console.log(response);
}).catch(error => {
  console.error(error);
});

Other packages similar to @aws-amplify/api-rest

FAQs

Package last updated on 29 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc