# Subscriptions: delete

**Requires [authorization](https://developers.google.com/glass/v1/reference/subscriptions/delete#auth)**

Deletes a subscription.
[See an example](https://developers.google.com/glass/v1/reference/subscriptions/delete#examples).

## Request

### HTTP request

```
DELETE https://www.googleapis.com/mirror/v1/subscriptions/id
```

### Parameters

| Parameter name | Value | Description |
|---|---|---|
| **Path parameters** |||
| `id` | `string` | The ID of the subscription. |

### Authorization

This request requires authorization with the following scope ([read more about authentication and authorization](https://developers.google.com/glass/authorization)).

| Scope |
|---|
| `https://www.googleapis.com/auth/glass.timeline` |

### Request body

Do not supply a request body with this method.

## Response

If successful, this method returns an empty response body.

## Examples

**Note:** The code examples available for this method do not represent all supported programming languages (see the [client libraries page](https://developers.google.com/glass/tools-downloads/client-libraries) for a list of supported languages).

### Java

Uses the [Java client library](https://developers.google.com/glass/tools-downloads/client-libraries).

```java
import com.google.api.services.mirror.Mirror;

import java.io.IOException;

public class MyClass {
  // ...

  /**
   * Delete a subscription to a collection.
   * 
   * @param service Authorized Mirror service.
   * @param collection Collection to unsubscribe from (supported values are
   *        "timeline" and "locations").
   */
  public static void unsubscribeFromNotifications(Mirror service, String collection) {
    try {
      service.subscriptions().delete(collection).execute();
    } catch (IOException e) {
      System.err.println("An error occurred: " + e);
    }
  }

  // ...
}
```

### .NET

Uses the [.NET client library](https://developers.google.com/glass/tools-downloads/client-libraries).

```
using System;

using Google.Apis.Mirror.v1;

public class MyClass {
  // ...

  /// <summary>
  /// Delete a subscription to a collection.
  /// </summary>
  /// <param name='service'>Authorized Mirror service.</param>
  /// <param name='collection'>
  /// Collection to unsubscribe from (supported values are "timeline" and
  /// "locations").
  /// </param>
  public static void UnsubscribeFromNotifications(MirrorService service,
      String collection) {
    try {
      service.Subscriptions.Delete(collection).Fetch();
    } catch (Exception e) {
      Console.WriteLine("An error occurred: " + e.Message);
    }
  }

  // ...
}
```

### PHP

Uses the [PHP client library](https://developers.google.com/glass/tools-downloads/client-libraries).

```php
/**
 * Delete a subscription to a collection.
 *
 * @param Google_MirrorService $service Authorized Mirror service.
 * @param string $collection Collection to unsubscribe from (supported values
 *                           are "timeline" and "locations").
 */
function unsubscribeFromNotifications($service, $collection) {
  try {
    $service->subscriptions->delete($collection);
  } catch (Exception $e) {
    print 'An error occurred: ' . $e->getMessage();
  }
}
```

### Python

Uses the [Python client library](https://developers.google.com/glass/tools-downloads/client-libraries).

```python
from apiclient import errors
# ...

def unsubscribe_from_notifications(service, collection):
  """Delete a subscription to a collection.

  Args:
    service: Authorized Mirror service.
    collection: Collection to unsubscribe from (supported values are
                "timeline" and "locations"
  """
  try:
    service.subscriptions().delete(collection).execute()
  except errors.HttpError, error:
    print 'An error occurred: %s' % error
```

### Ruby

Uses the [Ruby client library](https://developers.google.com/glass/tools-downloads/client-libraries).

```ruby
##
# Delete a subscription to a collection.
#
# @param [Google::APIClient] client
#   Authorized client instance.
# @param [String] collection
#   Collection to unsubscribe from (supported values are "timeline" and
#   "locations").
# @return nil
def unsubscribe_from_notifications(client, collection)
  mirror = client.discovered_api('mirror', 'v1')
  result = client.execute(
    :api_method => mirror.subscriptions.delete,
    :parameters => { 'id' => collection })
  if result.error?
    puts "An error occurred: #{result.data['error']['message']}"
  end
end
```

### Go

Uses the [Go client library](https://developers.google.com/glass/tools-downloads/client-libraries).

```go
import (
	"code.google.com/p/google-api-go-client/mirror/v1"
	"fmt"
)

// UnsubscribeFromNotifications deletes a subscription to a collection.
func UnsubscribeFromNotifications(g *mirror.Service, collection string) error {
	err := g.Subscriptions.Delete(collection).Do()
	if err != nil {
		fmt.Printf("An error occurred: %v\n", err)
		return err
	}
	return nil
}
```

### Raw HTTP

Does not use a client library.

```
DELETE /mirror/v1/subscriptions/timeline HTTP/1.1
Authorization: Bearer auth token
```