Created
September 29, 2016 00:05
-
-
Save RenanSMoura/c95b2ee33c60ccb08b9c55aeff8e9bfe to your computer and use it in GitHub Desktop.
Script add marcas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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