需要授權
刪除時間軸項目。請點選此處查看範例。
要求
HTTP 要求
DELETE https://www.googleapis.com/mirror/v1/timeline/id
參數
| 參數名稱 | 價值 | 說明 |
|---|---|---|
| 路徑參數 | ||
id |
string |
時間軸項目的 ID。 |
授權
這項要求需要至少擁有下列其中一個範圍的授權 (進一步瞭解驗證和授權)。
| 內容範圍 |
|---|
https://www.googleapis.com/auth/glass.timeline |
https://www.googleapis.com/auth/glass.location |
要求主體
請勿使用這個方法提供請求主體。
回覆
如果成功,這個方法會傳回空白的回應主體。
示例
注意:這個方法適用的程式語言眾多,我們只在此提供部分程式碼範例,完整的支援語言清單請參閱用戶端程式庫頁面。
Java
使用 Java 用戶端程式庫。
import com.google.api.services.mirror.Mirror;
import java.io.IOException;
public class MyClass {
// ...
/**
* Delete a timeline item.
*
* @param service Authorized Mirror service.
* @param itemId ID of the timeline item to delete.
*/
public static void deleteTimelineItem(Mirror service, String itemId) {
try {
service.timeline().delete(itemId).execute();
} catch (IOException e) {
System.err.println("An error occurred: " + e);
}
}
// ...
}
.NET
使用 .NET 用戶端程式庫。
using System;
using Google.Apis.Mirror.v1;
public class MyClass {
// ...
/// <summary>
/// Delete a timeline item.
/// </summary>
/// <param name='service'>Authorized Mirror service.</param>
/// <param name='itemId'>ID of the timeline item to delete.</param>
public static void DeleteTimelineItem(MirrorService service,
String itemId) {
try {
service.Timeline.Delete(itemId).Fetch();
} catch (Exception e) {
Console.WriteLine("An exception occurred: " + e.Message);
}
}
// ...
}
PHP
使用 PHP 用戶端程式庫。
/**
* Delete a timeline item.
*
* @param Google_MirrorService $service Authorized Mirror service.
* @param string $itemId ID of the timeline item to delete.
*/
function deleteTimelineItem($service, $itemId) {
try {
$service->timeline->delete($itemId);
} catch (Exception $e) {
print 'An error occurred: ' . $e->getMessage();
}
}
Python
使用 Python 用戶端程式庫。
from apiclient import errors
# ...
def delete_timeline_item(service, item_id):
"""Delete a timeline item.
Args:
service: Authorized Mirror service.
item_id: ID of the timeline item to delete.
"""
try:
service.timeline().delete(id=item_id).execute()
except errors.HttpError, e:
print 'An error occurred: %s' % error
小茹
使用 Ruby 用戶端程式庫。
##
# Delete a Timeline Item.
#
# @param [Google::APIClient] client
# Authorized client instance.
# @param [string] item_id
# ID of the timeline item to delete.
# @return nil
def delete_timeline_item(client, item_id)
mirror = client.discovered_api('mirror', 'v1')
result = client.execute(
:api_method => mirror.timeline.delete,
:parameters => { 'id' => item_id })
if result.error?
puts "An error occurred: #{result.data['error']['message']}"
end
end
查看
使用 Go 用戶端程式庫。
import (
"code.google.com/p/google-api-go-client/mirror/v1"
"fmt"
)
// DeleteTimelineItem deletes a timeline item.
func DeleteTimelineItem(g *mirror.Service, itemId string) error {
err := g.Timeline.Delete(itemId).Do()
if err != nil {
fmt.Printf("An error occurred: %v\n", err)
}
return err
}
原始 HTTP
不使用用戶端程式庫。
DELETE /mirror/v1/timeline/timeline item id HTTP/1.1 Host: www.googleapis.com Authorization: Bearer auth token