Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8359205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:04:20+00:00 2026-06-09T11:04:20+00:00

I’m using the official Google Ruby gem and, while so far everything else I’ve

  • 0

I’m using the official Google Ruby gem and, while so far everything else I’ve tried is working fine (including listing projects, datasets and tables, and creating tables), kicking off a load job is failing with the following inside the JSON error response:

"Job configuration must contain exactly one job-specific configuration object (e.g., query, load, extract, spreadsheetExtract), but there were 0: "

The body string that I created looks like:

--xxx
Content-Type: application/json; charset=UTF-8
{"configuration":{"load":{"destinationTable":{"projectId":"mycompany.com:projectId","datasetId":"all_events","tableId":"install"},"createDisposition":"CREATE_NEVER","writeDisposition":"WRITE_APPEND"}}}
--xxx
Content-Type: application/octet-stream
test,second,1234,6789,83838
--xxx

I’ve previously created the install table with an appropriate schema for that data, so that shouldn’t be the problem.

And finally, just for completeness, here is the actual piece of code I’m using to fire off the request (these are two methods within a larger class):

def create_insert_job
  config = {
    'configuration' => {
      'load' => {
        'destinationTable' => {
          'projectId' => 'mycompany.com:projectId',
          'datasetId' => 'all_events',
          'tableId' => 'install'
        },
        'createDisposition' => 'CREATE_NEVER',
        'writeDisposition' => 'WRITE_APPEND'
      }
    }
  }

  body = "#{multipart_boundary}\n"
  body += "Content-Type: application/json; charset=UTF-8\n"
  body += "#{config.to_json}\n"
  body += "#{multipart_boundary}\n"
  body +="Content-Type: application/octet-stream\n"
  body += "test,second,1234,6789,83838\n"
  body += "#{multipart_boundary}\n"

  prepare_big_query # This simply gets tokens and instantiates google_client and big_query_api
  param_hash = { api_method: big_query_api.jobs.insert }
  param_hash[:parameters] = {'projectId' =>'mycompany.com:projectId'}
  param_hash[:body] = body
  param_hash[:headers] = {'Content-Type' => "multipart/related; boundary=#{multipart_boundary}"}

  result = google_client.execute(param_hash)
  JSON.parse(result.response.body)
end

def multipart_boundary
  '--xxx'
end

Any ideas?

ADDITIONS TO THE ANSWER BELOW TO MAKE THIS CODE WORK

Note that the above #multipart_boundary method returns with the ‘–‘ prepended already. This is a problem, as setting the boundary header (in the param hash) will result in ‘–xxx’ when really we want ‘xxx’.

Also, the docs for this gem are pretty rough, because after fixing my newline problem (per @jcondit’s answer) I was getting a new error about uploading to the wrong URL. That’s because you need to do add:

'uploadType' => 'multipart'

to the parameters in order to send the request to the proper URL.

So the final param_hash that worked (again, after fixing the newlines and boundary isses) looks like:

param_hash = { api_method: big_query_api.jobs.insert }
param_hash[:parameters] = {'projectId' => project_id, 'uploadType' => 'multipart'}
param_hash[:body] = body
param_hash[:headers] = {'Content-Type' => "multipart/related; boundary=#{multipart_boundary}"}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:04:21+00:00Added an answer on June 9, 2026 at 11:04 am

    You need to insert an extra newline between the headers of each MIME part and the body of each MIME part. The body of your request should look like this:

    --xxx
    Content-Type: application/json; charset=UTF-8
    
    {"configuration":{"load":{"destinationTable":{"projectId":"mycompany.com:projectId","datasetId":"all_events","tableId":"install"},"createDisposition":"CREATE_NEVER","writeDisposition":"WRITE_APPEND"}}}
    --xxx
    Content-Type: application/octet-stream
    
    test,second,1234,6789,83838
    --xxx--
    

    Note the extra newline after the Content-Type header in each part.

    Also, don’t forget that the final boundary separator has a trailing — appended to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.