itconsultis / prestashop-api-client Goto Github PK
View Code? Open in Web Editor NEWJavascript PrestaShop API client
License: MIT License
Javascript PrestaShop API client
License: MIT License
Hi,
How can I use filtering as described in this documentation.Specifically I want to use the limit filter.
Thanks
I pasted code from README do app.js and run by
node app.js
I obtained the following error:
app.js:1
(function (exports, require, module, __filename, __dirname) { import { rest } from 'prestashop-api-client';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
Node version: v8.9.1
Npm version: 5.5.1
System: Ubuntu 16.04
Hi,
The postinstall script is not compatible with Windows environment.
Have a good day !
Just asking, I'm gonna try myself right now.
I'm testing fetch() but I can't get it done with the auth key
thanks!
Best Regards
Hi, I following the instructions and I get:
(node:5251) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
insert-product.js:19
import { rest } from 'prestashop-api-client';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1063:16)
at Module._compile (internal/modules/cjs/loader.js:1111:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
If I add the type module to package.json or rename the file to mjs, I get:
(node:5260) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/run_main.js:54
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'prestashop-api-client' imported from /var/www/vagrant/testScraper/insert-product.mjs
at packageResolve (internal/modules/esm/resolve.js:575:9)
at moduleResolve (internal/modules/esm/resolve.js:600:14)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:644:13)
at Loader.resolve (internal/modules/esm/loader.js:94:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:240:28)
at ModuleWrap. (internal/modules/esm/module_job.js:42:40)
at link (internal/modules/esm/module_job.js:41:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
package.json:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"cheerio": "^1.0.0-rc.3",
"download-file": "^0.1.5",
"node-rest-client": "^3.1.0",
"puppeteer": "^2.1.1",
"read-json-sync": "^2.0.1",
"sync-request": "^6.1.0"
}
}
and the code is the same of the instructions:
import { rest } from 'prestashop-api-client';
const client = new rest.Client({
language: 'en',
languages: {
'en': 1,
'es': 2,
},
webservice: {
key: 'my_key',
scheme: 'http',
host: 'my_url',
root: '/api',
},
});
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.