3
votes

I'm trying to get dataset list from bigquery webserver with https get

following the documentation here: https://developers.google.com/bigquery/docs/reference/v2/datasets/list

i'm using slightly modified code from:
http://code.google.com/p/qt-google-bigquery/source/browse/manager_bigquery.cpp

getDatasetsList(QString strProjectID)
{
QString url = QString("https://www.googleapis.com/bigquery/v2/projects/%1/datasets?key=%2").arg(str_ProjectID).arg(this->api_key);
//Also tried without ?key= part

QNetworkRequest request;
request.setUrl( QUrl(url) );    //this also urlencodes
request.setRawHeader("Content-Type", "application/json");
request.setRawHeader("Authorization", (QString("Bearer %1").arg(m_Access_Token)).toLatin1());

//here i post the request as a http get asynchronously
}

i get back this error message:

Reply =  "{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "required",
    "message": "Required parameter is missing"
   }
  ],
  "code": 400,
  "message": "Required parameter is missing"
 }
}

Note:
I managed to run a query and get the results, so my access token seems to be valid, what am i doing wrong here?

SOLVED

Ah, actually the problem was in my coding, not the request, i posted it as a http post, not a get.

1
Would it be possible for you to inspect the raw HTTP request information and post it here? - Michael Manoochehri
Hey Attila, Post your "answer" in the box below, so that we can mark it as answered and give you some points :-) - Michael Manoochehri

1 Answers

0
votes

See answer in comment by original poster above - but basically make sure you are using GET instead of the POST method for an API call to list datasets. Other BigQuery API methods use POST, PUT, or PATCH.

https://developers.google.com/bigquery/docs/reference/v2/datasets/list