Fatal error to list customers [nodejs]

api

#1

Hello everyone,

I’m trying to use the example files in NodeJS that I found in (https://www.npmjs.com/package/splynx-nodejs-api).
My error happens when I run the ‘login_as_admin.js’ class.
Error bellow:


Request options: { method: ‘POST’,
uri: ‘MYHOST/api/2.0/admin/auth/tokens’,
headers:
{ ‘Content-type’: ‘application/json’,
‘User-Agent’: ‘Splynx JavaScript API 2.0’ },
body: ‘{“login”:“MYLOGIN”,“password”:“MYPASSWORD”,“auth_type”:“admin”}’ }
Response error: null
Response headers: { server: ‘nginx/1.10.3 (Ubuntu)’,
date: ‘Wed, 23 Jan 2019 22:30:20 GMT’,
‘content-type’: ‘text/html; charset=UTF-8’,
‘transfer-encoding’: ‘chunked’,
connection: ‘close’,
‘set-cookie’: [ ‘PHPSESSID=l1lhbr2gg2a0e65qa304492fq4; path=/’ ],
expires: ‘Thu, 19 Nov 1981 08:52:00 GMT’,
‘cache-control’: ‘no-store, no-cache, must-revalidate’,
pragma: ‘no-cache’,
‘strict-transport-security’: ‘max-age=15768000’ }
Response body:

Fatal error: Uncaught exceptions\http\BadRequest: Unable to verify your data submission. in /var/www/splynx/app/web/Controller.php:445
Stack trace:
#0 /var/www/splynx/app/base/Controller.php(94): web\Controller->beforeAction()
#1 /var/www/splynx/app/core/Router.php(304): base\Controller->runAction(404)
#2 /var/www/splynx/app/core/Router.php(252): core\Router->callError()
#3 /var/www/splynx/app/core/Router.php(39): core\Router->run()
#4 /var/www/splynx/app/BaseApp.php(94): core\Router->dispatch()
#5 /var/www/splynx/app/App.php(92): BaseApp->run()
#6 /var/www/splynx/web/index.php(28): App->run()
#7 {main}
thrown in /var/www/splynx/app/web/Controller.php on line 445

Login response: { response: null, statusCode: 200 }
Error { response: null, statusCode: 200 }

If you guys could give me a hand on this, would be very appreciated !

Thanks in advance!


#2

Please use this version.

Latest from unreleased (yet) Splynx version.


#3

Thank you, using the examples of this version (1.0.4) everything is working well.
The version (> 2.0) that I was trying to use were not working for me, maybe they are not stable yet.

Thank you again for your quick reply.