1
我正在傳遞2個JSON數組。但只有第一個JSON的數據插入Big Query中。任何人都可以請建議我哪裏錯了?我們可以在Big Query中使用post api請求插入多行嗎?
var req = {
method: 'POST',
url: 'https://www.googleapis.com/bigquery/v2/projects/pid/datasets/dataid/tables/tabid/insertAll',
headers: {
'Authorization': token1,
'Content-Type': 'application/json',
'scope': 'https://www.googleapis.com/auth/bigquery'
},
json: {
"rows": [{
"json": [{
'code': 'X-new',
"remark": '',
'resulting_status': 'Cancelled'
}, {
'code': 'X-jdkdjk',
"remark": '',
'resulting_status': 'Required'
}]
}]
}
};
console.log(JSON.stringify(req.json.rows));
request(req, function(error, response, body) {
if (error)
debug("Error occurred from client's server" + error);
else
console.log("Response......" + JSON.stringify(response.body));
});
你忘了一個獨特的insertId。 – Pentium10