untitled notebook

node v10.24.1
version: master
endpointsharetweet
var request = require('request'); var GeoJSON = require("geojson"); var stringify = require('json-stringify-safe'); var apikey = process.env.xapikey; let resultjson = {}; //To view vehicle function viewcar() { var options = { method: 'POST', url: 'https://app.detrack.com/api/v1/vehicles/view/all.json', headers: { 'x-api-key': apikey, } }; request(options, function(error, httpResponse, body) { var jsonresponse = stringify(body) lat1 = jsonresponse.vehicles[0].lat lng1 = jsonresponse.vehicles[0].lng resultjson = stringify({geometry:{type:"Point",coordinates:[lng1, lat1]},type:"Feature",properties:{}}); })};
// Request (PUT https://api.myjson.com/bins/cei3l) const options1 = { url: 'https://api.jsonbin.io/b/5d3e33a435e3f814032c155d', method: 'PUT', headers: { 'Content-Type':'application/json' }, body: resultjson }; function callback(error, response, body) { console.log(body) } request(options1, callback);
Loading…

no comments

    sign in to comment