Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@aws-amplify/api-rest
Advanced tools
Api-rest category of aws-amplify
@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.
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);
});
Axios is a popular promise-based HTTP client for the browser and Node.js. It provides a simple and easy-to-use API for making HTTP requests. Compared to @aws-amplify/api-rest, Axios is more general-purpose and not specifically tied to AWS services.
Fetch is a built-in JavaScript API for making HTTP requests. It is widely supported in modern browsers and provides a simple and flexible way to interact with RESTful endpoints. Unlike @aws-amplify/api-rest, Fetch is not specific to AWS and does not include built-in support for AWS services.
Superagent is a small, progressive client-side HTTP request library. It has a simple API and supports features like automatic serialization of JSON and form data. Superagent is more lightweight compared to @aws-amplify/api-rest and is not tied to AWS services.
INTERNAL USE ONLY
This package contains the AWS Amplify API REST category and is intended for internal use only. To integrate Amplify into your app, please use aws-amplify.
FAQs
Api-rest category of aws-amplify
The npm package @aws-amplify/api-rest receives a total of 698,411 weekly downloads. As such, @aws-amplify/api-rest popularity was classified as popular.
We found that @aws-amplify/api-rest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.