如何使用POST请求在Big Query中加载数据?

时间:2016-01-18 06:45:30

标签: json post load google-bigquery

我想使用POST请求在Big Query中加载数据。获取404错误。请告诉我哪里出错?

标题

  Authorization: Bearer xxxxx
  Content-Type : multipart/related; boundary=foo_bar_baz
  scope: https://www.googleapis.com/auth/bigquery

https://www.googleapis.com/upload/bigquery/v2/projects/demo_project/jobs?uploadType=multipart HTTP / 1.1

        --foo_bar_baz
        Content-Type: application/json; charset=UTF-8

        {
          "configuration": {
            "load": {
              "sourceFormat": "NEWLINE_DELIMITED_JSON",
              "schema": {
                "fields": [
                  {"name": "username", "type": "STRING"},
                  {"name": "password", "type": "INTEGER"}
                ]
              },
              "destinationTable": {
                "projectId": "universal-torch-116906",
                "datasetId": "demo_project",
                "tableId": "test_table"
              }
            }
          }
        }
        --foo_bar_baz
        Content-Type: application/octet-stream

        {"username":"Kutubuddin","password":123}
        --foo_bar_baz--

1 个答案:

答案 0 :(得分:3)

问题已解决。从URL中删除了HTTP / 1.1。