Contacts: delete

इसके लिए, अनुमति देना ज़रूरी है

संपर्क को मिटाता है. उदाहरण देखें.

अनुरोध करें

एचटीटीपी अनुरोध

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

पैरामीटर

पैरामीटर का नाम वैल्यू जानकारी
पाथ पैरामीटर
id string संपर्क का आईडी.

अनुमति देना

इस अनुरोध को नीचे दिए गए दायरे के साथ अनुमति देना ज़रूरी है (पुष्टि करने और मंज़ूरी देने के बारे में ज़्यादा पढ़ें).

स्कोप
https://www.googleapis.com/auth/glass.timeline

अनुरोध का मुख्य भाग

इस तरीके से, अनुरोध का मुख्य हिस्सा न दें.

जवाब

कामयाब रहने पर, इस तरीके से जवाब का फ़ॉर्मैट खाली होता है.

उदाहरण

ध्यान दें: इस तरीके के लिए दिए गए कोड के उदाहरणों में इसके साथ काम करने वाली सभी प्रोग्रामिंग भाषाएं नहीं दिखाई गई हैं (इसके साथ काम करने वाली भाषाओं की सूची के लिए क्लाइंट लाइब्रेरी वाला पेज देखें).

Java

Java क्लाइंट लाइब्रेरी का इस्तेमाल करता है.

import com.google.api.services.mirror.Mirror;
import com.google.api.services.mirror.model.Contact;

import java.io.IOException;

public class MyClass {
  // ...

  /**
   * Delete a contact for the current user.
   * 
   * @param service Authorized Mirror service.
   * @param contactId ID of the Contact to delete.
   */
  public static void deleteContact(Mirror service, String contactId) {
    try {
      service.contacts().delete(contactId).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 contact for the current user.
  /// </summary>
  /// <param name='service'>Authorized Mirror service.</param>
  /// <param name='contactId'>ID of the Contact to delete.</param>
  public static void DeleteContact(MirrorService service,
      String contactId) {
    try {
      service.Contacts.Delete(contactId).Fetch();
    } catch (Exception e) {
      Console.WriteLine("An error occurred: " + e.Message);
    }
  }

  // ...
}

PHP

PHP क्लाइंट लाइब्रेरी का इस्तेमाल करता है.

/**
 * Delete a contact for the current user.
 *
 * @param Google_MirrorService $service Authorized Mirror service.
 * @param string $contactId ID of the Contact to delete.
 */
function deleteContact($service, $contactId) {
  try {
    $service->contacts->delete($contactId);
  } catch (Exception $e) {
    print 'An error occurred: ' . $e->getMessage();
  }
}

Python

Python क्लाइंट लाइब्रेरी का इस्तेमाल करता है.

from apiclient import errors
# ...

def delete_contact(service, contact_id):
  """Delete a contact for the current user.

  Args:
    service: Authorized Mirror service.
    contact_id: ID of the Contact to delete.
  """
  try:
    service.contacts().delete(contact_id).execute()
  except errors.HttpError, error:
    print 'An error occurred: %s' % error

Ruby

Ruby क्लाइंट लाइब्रेरी का इस्तेमाल करता है.

##
# Delete a contact for the current user.
#
# @param [Google::APIClient] client
#   Authorized client instance.
# @param [String] contact_id
#   ID of the contact to delete.
# @return nil
def delete_contact(client, contact_id)
  mirror = client.discovered_api('mirror', 'v1')
  result = client.execute(
    :api_method => mirror.contacts.delete,
    :parameters => { 'id' => contact_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"
)

// DeleteContact deletes a contact for the current user.
func DeleteContact(g *mirror.Service, contactId string) error {
        err := g.Contacts.Delete(contactId).Do()
        if err != nil {
                fmt.Printf("An error occurred: %v\n", err)
        }
        return err
}

रॉ एचटीटीपी

क्लाइंट लाइब्रेरी का इस्तेमाल नहीं करता.

DELETE /mirror/v1/contacts/harold HTTP/1.1
Authorization: Bearer auth token