实例化 HttpWebRequest 并设置属性值:-
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("https://www.googleapis.com/upload/bigquery/v2/projects/776934660156/jobs");
request.Method = "POST";
request.ContentType = "multipart/related; boundary=xxx";
request.Headers.Add("Authorization: Bearer " + strAccessToken);//Service Account Access token
下面是 HttpWebRequest 对象的内容。当我通过此请求时,我收到错误 400 错误请求:-
--xxx
Content-Type: application/json; charset=UTF-8
{
"kind" : "bigquery#job" ,
"Id" : "testJob" ,
"configuration": {
"load": {
"destinationTable": {
"projectId": "776934660156",
"datasetId": "BMSTestDataset",
"tableId": "tblEvents"
},
"fieldDelimiter":"|",
}
}
}
--xxx
Content-Type: application/octet-stream
ET00000102|MT|50|Hindi|Halla Bol|2008-01-11 00:00:00|0|2007-08-07 15:51:38.240000000|<Genre><code>DRAMA</code></Genre>|<Legends><Actor>83</Actor><Actor>2457</Actor><Actor>1639</Actor><Actor>1151</Actor><Actor>1717</Actor><Actor>1526</Actor><Director>1801</Director><Music>820</Music></Legends>
ET00000103|MT|50|Hindi|Kisse Pyaar Karoon|2009-02-27 00:00:00|0|2007-08-07 17:16:36.443000000|<Genre><code>DRAMA</code></Genre>|<Legends><Actor>228</Actor><Actor>46</Actor><Actor>2539</Actor><Actor>2415</Actor><Actor>44</Actor><Actor>2161</Actor><Actor>2100</Actor><Director>82</Director><Music>2624</Music></Legends>
--xxx--
我没有指定架构,因为该表已经存在于 BQ 数据集中。请帮帮我,我做了很多研究,但没有得到任何解决方案。
谢谢