Timeline.attachments: delete
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
승인 필요
타임라인 항목에서 첨부파일을 삭제합니다.
예를 참조하세요.
요청
HTTP 요청
DELETE https://www.googleapis.com/mirror/v1/timeline/itemId/attachments/attachmentId
매개변수
매개변수 이름 |
값 |
설명 |
경로 매개변수 |
attachmentId |
string |
첨부파일의 ID입니다.
|
itemId |
string |
첨부파일이 속한 타임라인 항목의 ID입니다.
|
승인
이 요청을 처리하려면 다음 범위의 승인이 필요합니다 (인증 및 승인 자세히 알아보기).
범위 |
https://www.googleapis.com/auth/glass.timeline |
요청 본문
이 메소드를 사용할 때는 요청 본문을 제공하지 마세요.
응답
요청에 성공한 경우 이 메소드는 빈 응답 본문을 반환합니다.
예
참고: 이 메서드에 제공되는 코드 예시가 지원되는 모든 프로그래밍 언어를 나타내는 것은 아닙니다. 지원되는 언어 목록은 클라이언트 라이브러리 페이지를 참조하세요.
자바
Java 클라이언트 라이브러리를 사용합니다.
import com.google.api.services.mirror.Mirror;
import java.io.IOException;
public class MyClass {
// ...
/**
* Delete an item's attachment.
*
* @param service Authorized Mirror service.
* @param itemId ID of the timeline item the attachment belongs to.
* @param attachmentId ID of the attachment to delete.
*/
public static void deleteAttachment(Mirror service, String itemId, String attachmentId) {
try {
service.timeline().attachments().delete(itemId, attachmentId).execute();
} catch (IOException e) {
System.out.println("An error occured: " + e);
}
}
// ...
}
.NET
.NET 클라이언트 라이브러리를 사용합니다.
using System;
using Google.Apis.Mirror.v1;
using Google.Apis.Mirror.v1.Data;
public class MyClass {
// ...
/// <summary>
/// Delete an item's attachment.
/// </summary>
/// <param name="service">Authorized Mirror service.</param>
/// <param name="itemId">ID of the timeline item the attachment belongs to.</param>
/// <param name="attachmentId">ID of the attachment to delete.</param>
public static void DeleteAttachment(
MirrorService service, String itemId, String attachmentId) {
try {
service.Timeline.Attachments.Delete(itemId, attachmentId).Fetch();
} catch (Exception e) {
Console.WriteLine("An error occurred: " + e.Message);
}
}
// ...
}
PHP
PHP 클라이언트 라이브러리를 사용합니다.
/**
* Delete an item's attachment
*
* @param Google_MirrorService $service Authorized Mirror service.
* @param string $itemId ID of the timeline item the attachment belongs to.
* @param string $attachmentId ID of the attachment to delete.
*/
function deleteAttachment($service, $itemId, $attachmentId) {
try {
$service->timeline_attachments->delete($itemId, $attachmentId);
} catch (Exception $e) {
print "An error occurred: " . $e->getMessage();
}
}
Python
Python 클라이언트 라이브러리를 사용합니다.
from apiclient import errors
# ...
def delete_attachment(service, item_id, attachment_id):
"""Delete an item's attachment
Args:
service: Authorized Mirror service.
item_id: ID of the timeline item the attachment belongs to.
attachment_id: ID of the attachment to delete
"""
try:
service.timeline().attachments().delete(
itemId=item_id, attachmentId=attachment_id).execute()
except errors.HttpError, error:
print 'An error occurred: %s' % error
Ruby
Ruby 클라이언트 라이브러리 사용
##
# Delete an item's attachment
#
# @param [Google::APIClient] client
# Authorized client instance.
# @param [String] item_id
# ID of the timeline item the attachment belongs to.
# @param [String] attachment_id
# ID of the attachment to delete.
# @return nil
def delete_attachment(client, item_id, attachment_id)
mirror = client.discovered_api('mirror', 'v1')
result = client.execute(
:api_method => mirror.timeline.attachments.delete,
:parameters => {
'itemId' => item_id,
'attachmentId' => attachment_id
})
if result.error?
puts "An error occurred: #{result.data['error']['message']}"
end
end
원시 HTTP
클라이언트 라이브러리를 사용하지 않습니다.
DELETE /mirror/v1/timeline/timeline item id/attachments/attachment id HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer auth token
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-10-13(UTC)
[null,null,["최종 업데이트: 2024-10-13(UTC)"],[[["\u003cp\u003eDeletes an attachment from a specified timeline item using its ID.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with the \u003ccode\u003ehttps://www.googleapis.com/auth/glass.timeline\u003c/code\u003e scope.\u003c/p\u003e\n"],["\u003cp\u003eThe request body should be empty, using the DELETE HTTP method.\u003c/p\u003e\n"],["\u003cp\u003eProvides code examples in Java, .NET, PHP, Python, and Ruby demonstrating the attachment deletion process.\u003c/p\u003e\n"]]],[],null,["# Timeline.attachments: delete\n\n**Requires [authorization](#auth)**\n\nDeletes an attachment from a timeline item.\n[See an example](#examples).\n\nRequest\n-------\n\n### HTTP request\n\n```\nDELETE https://www.googleapis.com/mirror/v1/timeline/itemId/attachments/attachmentId\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|----------------|----------|--------------------------------------------------------|\n| **Path parameters** |||\n| `attachmentId` | `string` | The ID of the attachment. |\n| `itemId` | `string` | The ID of the timeline item the attachment belongs to. |\n\n### Authorization\n\nThis request requires authorization with the following scope ([read more about authentication and authorization](/glass/authorization)).\n\n| Scope |\n|--------------------------------------------------|\n| `https://www.googleapis.com/auth/glass.timeline` |\n\n### Request body\n\nDo not supply a request body with this method.\n\nResponse\n--------\n\nIf successful, this method returns an empty response body.\n\nExamples\n--------\n\n**Note:** The code examples available for this method do not represent all supported programming languages (see the [client libraries page](/glass/tools-downloads/client-libraries) for a list of supported languages). \n\n### Java\n\nUses the [Java client library](/glass/tools-downloads/client-libraries). \n\n```java\nimport com.google.api.services.mirror.Mirror;\n\nimport java.io.IOException;\n\npublic class MyClass {\n // ...\n\n /**\n * Delete an item's attachment.\n * \n * @param service Authorized Mirror service.\n * @param itemId ID of the timeline item the attachment belongs to.\n * @param attachmentId ID of the attachment to delete.\n */\n public static void deleteAttachment(Mirror service, String itemId, String attachmentId) {\n try {\n service.timeline().attachments().delete(itemId, attachmentId).execute();\n } catch (IOException e) {\n System.out.println(\"An error occured: \" + e);\n }\n }\n\n // ...\n}\n```\n\n### .NET\n\nUses the [.NET client library](/glass/tools-downloads/client-libraries). \n\n```css+lasso\nusing System;\nusing Google.Apis.Mirror.v1;\nusing Google.Apis.Mirror.v1.Data;\n\npublic class MyClass {\n // ...\n\n /// \u003csummary\u003e\n /// Delete an item's attachment.\n /// \u003c/summary\u003e\n /// \u003cparam name=\"service\"\u003eAuthorized Mirror service.\u003c/param\u003e\n /// \u003cparam name=\"itemId\"\u003eID of the timeline item the attachment belongs to.\u003c/param\u003e\n /// \u003cparam name=\"attachmentId\"\u003eID of the attachment to delete.\u003c/param\u003e\n public static void DeleteAttachment(\n MirrorService service, String itemId, String attachmentId) {\n try {\n service.Timeline.Attachments.Delete(itemId, attachmentId).Fetch();\n } catch (Exception e) {\n Console.WriteLine(\"An error occurred: \" + e.Message);\n }\n }\n\n // ...\n}\n```\n\n### PHP\n\nUses the [PHP client library](/glass/tools-downloads/client-libraries). \n\n```php\n/**\n * Delete an item's attachment\n *\n * @param Google_MirrorService $service Authorized Mirror service.\n * @param string $itemId ID of the timeline item the attachment belongs to.\n * @param string $attachmentId ID of the attachment to delete.\n */\nfunction deleteAttachment($service, $itemId, $attachmentId) {\n try {\n $service-\u003etimeline_attachments-\u003edelete($itemId, $attachmentId);\n } catch (Exception $e) {\n print \"An error occurred: \" . $e-\u003egetMessage();\n }\n}\n```\n\n### Python\n\nUses the [Python client library](/glass/tools-downloads/client-libraries). \n\n```python\nfrom apiclient import errors\n# ...\n\ndef delete_attachment(service, item_id, attachment_id):\n \"\"\"Delete an item's attachment\n\n Args:\n service: Authorized Mirror service.\n item_id: ID of the timeline item the attachment belongs to.\n attachment_id: ID of the attachment to delete\n \"\"\"\n try:\n service.timeline().attachments().delete(\n itemId=item_id, attachmentId=attachment_id).execute()\n except errors.HttpError, error:\n print 'An error occurred: %s' % error\n```\n\n### Ruby\n\nUses the [Ruby client library](/glass/tools-downloads/client-libraries). \n\n```ruby\n##\n# Delete an item's attachment\n#\n# @param [Google::APIClient] client\n# Authorized client instance.\n# @param [String] item_id\n# ID of the timeline item the attachment belongs to.\n# @param [String] attachment_id\n# ID of the attachment to delete.\n# @return nil\ndef delete_attachment(client, item_id, attachment_id)\n mirror = client.discovered_api('mirror', 'v1')\n result = client.execute(\n :api_method =\u003e mirror.timeline.attachments.delete,\n :parameters =\u003e {\n 'itemId' =\u003e item_id,\n 'attachmentId' =\u003e attachment_id\n })\n if result.error?\n puts \"An error occurred: #{result.data['error']['message']}\"\n end\nend\n```\n\n### Raw HTTP\n\nDoes not use a client library. \n\n```text\nDELETE /mirror/v1/timeline/timeline item id/attachments/attachment id HTTP/1.1\nHost: www.googleapis.com\nAuthorization: Bearer auth token\n```"]]