aaditya / magento-api-rest Goto Github PK
View Code? Open in Web Editor NEWNodeJS wrapper to communicate with Magento REST APIs.
License: MIT License
NodeJS wrapper to communicate with Magento REST APIs.
License: MIT License
This should be resolved with an update in the package.json
warning magento-api-rest > [email protected]: Critical security vulnerability fixed in v0.21.1. For more information, see axios/axios#3410
Already tried to import magento-api-rest in all known ways.
No matter what I do I keep receiving the response below.
Response
{
"errorType": "ReferenceError",
"errorMessage": "Magento is not defined",
"trace": [
"ReferenceError: Magento is not defined",
" at Runtime.handler (file:///var/task/index.mjs:6:20)",
" at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1089:29)"
]
}
Hi, I'm on Magento 1.9 and I'm getting the 404 error.
Here's my request
const Magento = require('magento-api-rest').default;
const client = new Magento({
'url': '<base_url>/index.php/api/rest', // tried with only <base_url> and <base_url/index.php>
'consumerKey': '<consumer-key>',
'consumerSecret': '<secret>',
'accessToken': '<permanent access token>',
'tokenSecret': '<token secret>',
});
client.get('/products', {}).then(function (result) {console.log(result)}).catch(function (error) {console.log(error.message)});
PS: I actually need to list all the customers, /customers is giving the same error.
PS: 2... I followed this tutorial https://www.eglobeits.com/blog/how-to-access-magento-rest-and-oAuth-settings-for-rest-api/
to generate oAuth creds... Even here I get 404 in postman in last step, ie.
Method: GET
Url:http://your-url.com/api/rest/products
PS: 3... I didn't setup magento from scratch, instead used a google marketplace installation https://console.cloud.google.com/marketplace/product/miriinfotech-public/magento-31-january-2020?authuser=4&project=apt-cubist-307713
Thanks
Hi -
We are encountering signature generation issues using this library. We are on the 2.3.3 M2 codebase with the latest security patch (2.3.3-p1).
Using the code snippet below, the console logs an error, specifically:
'The signature is invalid. Verify and try again.'
const magClient = new MagentoAPI({
url: 'https://redacted.com',
consumerKey: 'XXX',
consumerSecret: 'XXX',
accessToken: 'XXX',
tokenSecret: 'XXX',
// 'magentoVersion': 'V1'
});
magClient
.get('orders', {})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.log(error);
});
I have switched between SHA1, SHA256, etc to no avail. In your experience, is there anything obvious that may be causing this issue?
TIA
H there, I have installed "npm i magento-api-rest" and it didnt install the ./lib/transform folder, any guess what could be wrong?
Thank you,
Hi there
i have issue on save product update using put
var Magento = require("magento-api-rest").default;
function get_client(store) {
return new Magento({
url: store.url,
consumerKey: store.consumerkey,
consumerSecret: store.consumersecret,
accessToken: store.accesstoken,
tokenSecret: store.tokensecret,
sha: 256,
});
}
client
.put("products/" + product_sku + "/", { product:Product, saveOptions: true })
.then((res) => {
console.log(res);
})
.catch((e) => {
console.log(e);
});
according to some question in stackexchange there should be prefix for this purpose
https://magento.stackexchange.com/questions/164278/update-product-using-rest-api-in-magento-2
https://magento.stackexchange.com/questions/151929/magento-2-update-a-product-name-using-rest-api
how can i add store code or all prefix
thanks in advance
module version: 2.0.4
Magento version: 2.4.3
I am getting a 401 response and data message of "The signature is invalid. Verify and try again."
const Magento = require('magento-api-rest').default
const client = new Magento({
'url': 'http://<sitetempurlstring>.mojostratus.io/',
'consumerKey': '<my integration key>',
'consumerSecret': '<my integration secret>',
'accessToken': '<my integration token>',
'tokenSecret': '<my integration token secret>',
});
async function getOrders () {
try {
let { data } = await client.get('products');
console.log(data)
} catch (err) {
console.log('err', err)
}
}
getOrders()
Any help would be greatly appreciated
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.