podio / podio-js

Official Podio JavaScript SDK for node and the browser
http://podio.github.io/podio-js/
MIT License
45 stars 49 forks source link

PDF file upload existing record using node js #57

Open RGKrish183 opened 7 years ago

RGKrish183 commented 7 years ago

Hi,

I have one file upload field. use node js to upload pdf file in existing records. i don't have file id because not added via in front end. i just use api to upload in existing record. I don't know what is right way. i just founded and try this,

i just try source for two type things :

Note : fileconents(source of the file), local file path.

############# FIRST FORMAT #################

var filePath = '/home/hoffensoft/Desktop/query.pdf'; var file = 'query.pdf';

podio.request('post','/file/', {'source': filePath, 'filename':file}, function(response, body){ console.log(body); }).catch(function(err) { console.log('errors podio.request'); console.log(err); });

But I'm getting PodioNotFoundError only. And also i have major doubt is, HOW I HAVE UPLOAD EXACTLY IN PARTICULAR RECORD, BECAUSE THERE DONT HAVE RECORD PRIMARY KEY OR SOMTHING LIKE THAT,.

############# SECOND FORMAT #################

var filePath = '/home/hoffensoft/Desktop/query.pdf'; var file = 'query.pdf';

podio.uploadFile(filePath, file, function(response){

console.log('response'); console.log(response);

}).catch(function(err){ console.log("Error"); console.log(err); });

Below error was i'm getting

{ PodioError at /opt/lampp/htdocs/podio/node_modules/podio-js/lib/PodioErrors.js:67:19 at /opt/lampp/htdocs/podio/node_modules/podio-js/node_modules/lodash/index.js:3073:15 at baseForOwn (/opt/lampp/htdocs/podio/node_modules/podio-js/node_modules/lodash/index.js:2046:14) at /opt/lampp/htdocs/podio/node_modules/podio-js/node_modules/lodash/index.js:3043:18 at Function. (/opt/lampp/htdocs/podio/node_modules/podio-js/node_modules/lodash/index.js:3346:13) at Object. (/opt/lampp/htdocs/podio/node_modules/podio-js/lib/PodioErrors.js:66:3) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) message: 'File uploads are only supported on the server right now.', status: undefined, url: undefined, name: 'PodioError' }

Please kindly help and get out from this issue. Thanks in advance

Nazaroni commented 4 years ago

Same issue there... and for Podio with NodeJS almost zero information, that's really sad.