POST リクエストを使用して BigQuery テーブルにデータを挿入しようとしています。私のアプリケーションは、指定された形式で要求するボディを作成します:
--xxx
Content-Type: application/json; charset=UTF-8
{
"configuration": {
"load": {
"sourceFormat": "NEWLINE_DELIMITED_JSON"
},
"destinationTable": {
"projectId": "some-id",
"datasetId": "dataset-id",
"tableId": "cards"
}
}
}
--xxx
Content-Type: application/octet-stream
{"board_id":1,"version":2,"card_id":1,"title":"Tytul kartki 1"}
--xxx--
しかし、次を使用してこのデータを送信すると:
credentials = SignedJwtAssertionCredentials(
SERVICE_ACCOUNT_EMAIL,
key,
scope='https://www.googleapis.com/auth/bigquery')
self.http = credentials.authorize(httplib2.Http())
headers = {'Content-Type': 'multipart/related; boundary=xxx'}
resp, content = self.http.request(url, method="POST",
body=output,
headers=headers)
サーバーからの応答は次のとおりです。
Status: {'date': 'Thu, 25 Jul 2013 12:49:06 GMT', 'status': '400', 'content-length': '205', 'content-type': 'application/json', 'server': 'HTTP Upload Server Built on Jul 12 2013 17:12:36 (1373674356)'}
Content: {
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required parameter is missing"
}
],
"code": 400,
"message": "Required parameter is missing"
}
}
どのパラメーターが欠落しているかわかりません。ドキュメントで必要なパラメータはsourceUrisだけですが、GSからではなくリクエストボディからデータをロードしたいです。