# subscription.py

`GET` `/subscriptions`

  > Retrieve a subscription.

  Example request:

      GET /subscriptions HTTP/1.1

  Example response:

      HTTP/1.1 200 OK
      Vary: Accept
      Content-Type: 'application/x-json-stream'

  Status Codes: | 404 Not Found – ‘SubscriptionNotFound’: e[0][0]

`PUT` `/subscriptions`

  > Update an existing subscription.

  Example request:

      PUT /subscriptions HTTP/1.1

  Example response:

      HTTP/1.1 200 OK
      Vary: Accept
      Content-Type:

  Status Codes: | 400 Bad Request – ‘ValueError’: ‘Cannot decode json parameter list’ 404 Not Found – ‘SubscriptionNotFound’: e[0][0] 400 Bad Request – ‘InvalidObject’: e[0][0]

`POST` `/subscriptions`

  > Create a new subscription.

  Example request:

      POST /subscriptions HTTP/1.1

  Example response:

      HTTP/1.1 200 OK
      Vary: Accept
      Content-Type:

  Status Codes: | 400 Bad Request – ‘ValueError’: ‘Cannot decode json parameter list’ 409 Conflict – ‘SubscriptionDuplicate’: e.args[0][0] 500 Internal Server Error – e.__class__.__name__: e.args[0][0] 400 Bad Request – ‘InvalidObject’: e[0][0]

`GET` `/subscriptions`

  > Return all rules of a given subscription id.

  Example request:

      GET /subscriptions HTTP/1.1

  Example response:

      HTTP/1.1 200 OK
      Vary: Accept
      Content-Type: 'application/x-json-stream'

  Status Codes: | 404 Not Found – ‘RuleNotFound’: e.args[0][0] 404 Not Found – ‘SubscriptionNotFound’: e[0][0] 500 Internal Server Error – e.__class__.__name__: e.args[0]

`GET` `/subscriptions/<account>/<name=None>/Rules/States`

  > Return a summary of the states of all rules of a given subscription id.

  Example request:

      GET /subscriptions/<account>/<name=None>/Rules/States HTTP/1.1

  Example response:

      HTTP/1.1 200 OK
      Vary: Accept
      Content-Type: 'application/x-json-stream'

  Status Codes: | 500 Internal Server Error – e.__class__.__name__: e.args[0]

`GET` `/subscriptions`

  > Retrieve a subscription matching the given subscription id

  Example request:

      GET /subscriptions HTTP/1.1

  Example response:

      HTTP/1.1 200 OK
      Vary: Accept
      Content-Type: 'application/json'

  Status Codes: | 404 Not Found – ‘SubscriptionNotFound’: e.args[0][0] 500 Internal Server Error – e.__class__.__name__: e.args[0]