我必须发送具有以下结构的POST请求.
POST https://www.googleapis.com/fusiontables/v1/tables
Authorization: /* auth token here */
Content-Type: application/json
{
"name": "Insects",
"columns": [
{
"name": "Species",
"type": "STRING"
},
{
"name": "Elevation",
"type": "NUMBER"
},
{
"name": "Year",
"type": "DATETIME"
}
],
"description": "Insect Tracking Information.",
"isExportable": true
}
Run Code Online (Sandbox Code Playgroud)
我使用下面的代码发送POST请求,但我得到一个响应为"400 Bad Request"
String PostUrl = "https://www.googleapis.com/fusiontables/v1/tables";
HttpRequestFactory requestFactory = HTTP_TRANSPORT.createRequestFactory(credential);
//generate the REST based URL
GenericUrl url = new GenericUrl(PostUrl.replaceAll(" ", "%20"));
//make POST request
String requestBody = "{'name': 'newIndia','columns': [{'name': 'Species','type': 'STRING'}],'description': 'Insect Tracking Information.','isExportable': true}"; …
Run Code Online (Sandbox Code Playgroud) java post google-api-java-client google-fusion-tables google-oauth