अनुमति देना ज़रूरी है
टाइमलाइन आइटम से अटैचमेंट मिटाता है. उदाहरण देखें.
अनुरोध
एचटीटीपी अनुरोध
DELETE https://www.googleapis.com/mirror/v1/timeline/itemId/attachments/attachmentId
पैरामीटर
पैरामीटर का नाम | मान | ब्यौरा |
---|---|---|
पाथ पैरामीटर | ||
attachmentId |
string |
अटैचमेंट का आईडी. |
itemId |
string |
उस टाइमलाइन आइटम का आईडी जिससे अटैचमेंट जुड़ा है. |
अनुमति देना
इस अनुरोध के लिए नीचे दिए गए दायरे के साथ अनुमति की ज़रूरत है (पुष्टि करने और अनुमति देने के बारे में ज़्यादा पढ़ें).
दायरा |
---|
https://www.googleapis.com/auth/glass.timeline |
अनुरोध का मुख्य भाग
इस तरीके के साथ अनुरोध का मुख्य हिस्सा न दें.
जवाब
अगर यह तरीका सही तरीके से काम करता है, तो जवाब का मुख्य हिस्सा खाली होता है.
उदाहरण
ध्यान दें: इस तरीके के लिए दिए गए कोड के उदाहरणों में इसके साथ काम करने वाली सभी प्रोग्रामिंग भाषाएं नहीं दिखाई गई हैं (इसके साथ काम करने वाली भाषाओं की सूची के लिए क्लाइंट लाइब्रेरी वाला पेज देखें).
Java
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
रॉ एचटीटीपी
क्लाइंट लाइब्रेरी का इस्तेमाल नहीं करता.
DELETE /mirror/v1/timeline/timeline item id/attachments/attachment id HTTP/1.1 Host: www.googleapis.com Authorization: Bearer auth token