Skip to content

Instantly share code, notes, and snippets.

@RenanSMoura
Created September 29, 2016 00:05
Show Gist options
  • Save RenanSMoura/c95b2ee33c60ccb08b9c55aeff8e9bfe to your computer and use it in GitHub Desktop.
Save RenanSMoura/c95b2ee33c60ccb08b9c55aeff8e9bfe to your computer and use it in GitHub Desktop.
Script add marcas
var requestify = require('requestify');
var fs = require('fs');
var json = JSON.parse(fs.readFileSync('marcasjson.txt','utf-8'));
for(var i = 0; i < json.length; i++){
var marcaVeiculo = json[i].marca;
var paisVeiculo = json[i].pais;
console.log(paisVeiculo);
requestify.request('http://notifycar-api.mybluemix.net/fabricante',{
method: 'POST',
body:{
marca:marcaVeiculo,
pais:paisVeiculo
},
headers:{
'Content-Type': 'application/json; charset=utf-8'
},
dataType:'json'
}).then(function(response){
response.getBody();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment