【发布时间】:2016-01-21 18:34:40
【问题描述】:
我正在传递 2 个 JSON 的数组。但只有第一个 JSON 的数据被插入到 Big Query 中。谁能建议我哪里出错了?
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。
标签: json upload http-post row google-bigquery