var request = require('request');
var filter=`'dateCreated ge '2020-04-01 00:00:00' and dateCreated le '2021-04-31 23:59:59'`;
var sorting = `dateCreated desc`;
'url': `https://api.portal.dynamicsmobile.com/livelink/entity/myapparea/MOBFL/GeoLocationEvent/query?$filter=${filter}&$orderby=${sorting}`,
request(options, function (error, response) {
if (error) throw new Error(error);
const jsonResponse = response.body;
const arrayOfMobileEntities = JSON.parse(jsonResponse);
for(const eventIndex in arrayOfMobileEntities ){
const event = arrayOfMobileEntities[eventIndex];
console.log(`new mobile event on ${event.DMS_DATEMODIFIED}` );
//parse reponse and obtain the value if the uploadPath field.
//use it to upload the packet content via PUT request