我正在创建一个curl(成功)的表:
$ curl https://www.googleapis.com/bigquery/v2/projects/s2g-bd1-001/datasets/integration_tests/tables?key=$BQKEY -H 'Authorization: Bearer '$BQAUTH -H 'Content-Type: application/json' -d '{"kind": "bigquery#table", "tableReference": {"projectId": "s2g-bd1-001", "datasetId": "integration_tests", "tableId": "0479414158500731"}, "friendlyName": "afriendlyname", "description": "afriendlydescription", "schema": {"fields": [{"name": "field1", "type": "STRING"} ] } }'
{
"kind": "bigquery#table",
"etag": "\"p8M0C9D2VWWNeiiBOvzKozM5ryM/W3ReJVrhvIimKGxRGXUdDJZI93w\"",
"id": "s2g-bd1-001:integration_tests.0479414158500731",
"selfLink": "https://www.googleapis.com/bigquery/v2/projects/s2g-bd1-001/datasets/integration_tests/tables/0479414158500731",
"tableReference": {
"projectId": "s2g-bd1-001",
"datasetId": "integration_tests",
"tableId": "0479414158500731"
},
"friendlyName": "afriendlyname",
"description": "afriendlydescription",
"schema": {
"fields": [
{
"name": "field1",
"type": "STRING"
}
]
},
"creationTime": "1403588096488",
"lastModifiedTime": "1403588096488"
}
然后我得到一个404试图让它回来......
$ curl https://www.googleapis.com/bigquery/v2/projects/s2g-bd1-001/datasets/integration_tests/tables/0479414158500731?key=$BQKEY -H 'Authorization: Bearer '$BQAUTH
{
"error": {
"errors": [ {
"domain": "global",
"reason": "notFound",
"message": "Not Found: Table s2g-bd1-001:integration_tests.0479414158500731"
} ],
"code": 404,
"message": "Not Found: Table s2g-bd1-001:integration_tests.0479414158500731"
}
}
可以肯定的是,该表已经创建,因为另一个发布它的调用返回409:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "duplicate",
"message": "Already Exists: Table s2g-bd1-001:integration_tests.0479414158500731"
}
],
"code": 409,
"message": "Already Exists: Table s2g-bd1-001:integration_tests.0479414158500731"
}
}
我能够创建一些像这样的东西并且能够看到它们,但是突然之后桌子就不再实现了,即使帖子成功了。我应该补充一点,我能够通过Web控制台成功创建表。
发生了什么事??
答案 0 :(得分:0)
当您收到表创建的响应时,它将同步创建。这意味着一旦收到您的回复,您应该能够立即与之互动。您可以在响应中看到creationTime
字段。
我不确定你为什么收到get方法的404。也许添加一些尝试逻辑并在两者之间等待一两秒。响应是表资源,因此您也可以使用它而不是再次检索它。
PS:发布时你是否在curl中省略了POST?