Upload file in node.js app

Discussions

Ask a Question
Back to All

Upload file in node.js app

Gorgias upload file has the following documentation:

const sdk = require('api')('@gorgias-developers/v1.0#fgg25lq0zlwrl');

sdk.auth('email' 'api_key');
sdk.postApiUpload({
file: '51c1076a502ed528e6696c72b5fecfef.png'
}, {type: 'attachment'})
.then(({ data }) => console.log(data))
.catch(err => console.error(err));

and it works in the documentation when you click in try it

But how does it works in an node.js app?

If i try to put into file property the path to my file, it always return "

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

\n"