Timeline: delete

ต้องมีการให้สิทธิ์

ลบรายการไทม์ไลน์ ดูตัวอย่าง

ส่งคำขอ

คำขอ HTTP

DELETE https://www.googleapis.com/mirror/v1/timeline/id

พารามิเตอร์

ชื่อพารามิเตอร์ ค่า คำอธิบาย
พารามิเตอร์เส้นทาง
id string รหัสของรายการไทม์ไลน์

การให้สิทธิ์

คําขอนี้ต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 ขอบเขต (อ่านเพิ่มเติมเกี่ยวกับการตรวจสอบสิทธิ์และการให้สิทธิ์)

ขอบเขต
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

ใช้ไลบรารีของไคลเอ็นต์ 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

ใช้ไลบรารีของไคลเอ็นต์ 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