Creating a request body for Google Bigquery API

Creating a request body for Google Bigquery API


I've been working on an app to automate the moving of data in Google Bigquery (GBQ). 

What it should do is select data from table1 using a query and append that result to table2. When using the GBQ UI this is how data is moved and the API should also support this. 

I am able to send queries for selecting data but when I format it to append the result to a table I get an error about a missing parameter. 

I know this is a question specifick to the Google API, but I am wondering if anyone here has been able to get this to work. 



The request body is;

"configuration" : {
    "query" : {
        "query" : "SELECT * FROM  Dataset.Table1 WHERE 1 = 1",
        "createDisposition" : "CREATE_IF_NEEDED",
        "destinationTable" : {
            "datasetId" : "DatasetId",
            "projectId" : "projectId",
            "tableId" : "table2Id"
        "useLegacySql" : false,
        "writeDispostion" : "WRITE_APPEND"

To which I get the following response;

HTTP/1.1 400 BadRequest
Content-Type: application/json; charset=UTF-8
Vary: X-Origin,Origin,Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Alt-Svc: quic=":443"; ma=2592000; v="44,43,39,35"
Transfer-Encoding: chunked
Accept-Ranges: none
Cache-Control: private, max-age=0
Date: Tue, 28 Aug 2018 10:07:22 GMT
Expires: Tue, 28 Aug 2018 10:07:22 GMT
Server: GSE
  "error": {
    "errors": [
        "domain": "global",
        "reason": "required",
        "message": "Required parameter is missing"
    "code": 400,
    "message": "Required parameter is missing"