On GitHub you will find some examples of code (Node.js) that can used to access the viewneo API.
Here are some code examples on GitHub https://github.com/viewneo/viewneo-api/tree/master/examples
https://github.com/viewneo/viewneo-api/blob/master/examples/nodejs/create-website.jsx
const request = require('request');
// Your personal access token (see README.md for more information)
const access_token = 'YOUR ACCESS TOKEN';
// options for the API request including the json body
var options = {
url: 'https://cloud.viewneo.com/api/v1.0/mediafile',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + access_token
},
body: JSON.stringify({
name: 'viewneo',
media_file_id_as_parent_directory: 0,
url: 'https://www.viewneo.com'
})
};
// perform the request and log the response
request(options, (error, response, body) => {
if (error) {
return console.error('Error: ', error);
}
console.log('Response body: ' + body);
});
https://github.com/viewneo/viewneo-api/blob/master/examples/nodejs/upload-image.jsx
const request = require('request');
const fs = require('fs');
// Your personal access token (see README.md for more information)
const access_token = 'YOUR ACCESS TOKEN';
// options for the API request including form data
var options = {
url: 'https://cloud.viewneo.com/api/v1.0/mediafile',
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data',
'Authorization': 'Bearer ' + access_token
},
formData: {
media_file_id_as_parent_directory: 0,
file: fs.createReadStream('./src/freya.jpg')
}
};
// perform the request and log the response
request(options, (error, response, body) => {
if (error) {
return console.error('Error: ', error);
}
console.log('Response body: ' + body);
});
Find more examples on GitHub https://github.com/viewneo/viewneo-api/tree/master/examples