Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@aws-amplify/api-rest
Advanced tools
@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
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 9 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.