我正在尝试使用 https get 从 bigquery 网络服务器获取数据集列表
遵循此处的文档: https ://developers.google.com/bigquery/docs/reference/v2/datasets/list
我正在使用稍微修改过的代码:
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
}
我收到此错误消息:
Reply = "{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required parameter is missing"
}
],
"code": 400,
"message": "Required parameter is missing"
}
}
注意:
我设法运行查询并获得结果,所以我的访问令牌似乎是有效的,我在这里做错了什么?
解决了
啊,实际上问题在于我的编码,而不是请求,我将其发布为 http 帖子,而不是 get。