# Subscription Rest API

Overview

Resource | Operation | Description
--- | --- | ---
Rules | GET /subscriptions/(account)/(name)/Rules | Get subscription rules.
States | GET /subscriptions/(account)/(name)/Rules/States | Get subscription rule states.
| GET /subscriptions/(account)/Rules/States |
Subscription | PUT /subscriptions/(account)/(name) | Update a subscription.
| POST /subscriptions/(account)/(name) | Create a subscription.
| GET /subscriptions/(account)/(name) | Get subscriptions.
| GET /subscriptions/(account) |
| GET /subscriptions/ |
SubscriptionId | GET /subscriptions/Id/(subscription_id) | Get a subscription by ID.

Details

`PUT` `/subscriptions/`(account)`/`(name)

  Update an existing subscription.

  Parameters: | account – The account name. name – The subscription name.
  Status Codes: | 201 Created – Created. 400 Bad Request – Cannot decode json parameter list. 401 Unauthorized – Invalid Auth Token. 404 Not Found – Subscription Not Found. 500 Internal Server Error – Internal Error.

`POST` `/subscriptions/`(account)`/`(name)

  Create a new subscription.

  Parameters: | account – The account name. name – The subscription name.
  Status Codes: | 201 Created – Created. 400 Bad Request – Cannot decode json parameter list. 401 Unauthorized – Invalid Auth Token. 404 Not Found – Subscription Not Found. 500 Internal Server Error – Internal Error.
  Returns: | ID if newly created subscription.

`GET` `/subscriptions/`(account)`/`(name)

`GET` `/subscriptions/`(account)

`GET` `/subscriptions/`

  Retrieve a subscription.

  Parameters: | account – The account name. name – The subscription name.
  Response Headers:
  | Content-Type – application/x-json-stream
  Status Codes: | 200 OK – OK. 401 Unauthorized – Invalid Auth Token. 404 Not Found – Subscription Not Found. 500 Internal Server Error – Internal Error.
  Returns: | Line separated list of dictionaries with subscription information.

`GET` `/subscriptions/`(account)`/`(name)`/Rules/States`

`GET` `/subscriptions/`(account)`/Rules/States`

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

  Parameters: | account – The account name. name – The subscription name.
  Response Headers:
  | Content-Type – application/x-json-stream
  Status Codes: | 200 OK – OK. 401 Unauthorized – Invalid Auth Token. 500 Internal Server Error – Internal Error.
  Returns: | Line separated list of dictionaries with rule information.

`GET` `/subscriptions/Id/`(subscription_id)

  Retrieve a subscription matching the given subscription id

  Parameters: | subscription_id – The subscription id.
  Response Headers:
  | Content-Type – application/json
  Status Codes: | 200 OK – OK. 401 Unauthorized – Invalid Auth Token. 404 Not Found – Subscription Not Found. 500 Internal Server Error – Internal Error.
  Returns: | dictionary with subscription information.

`GET` `/subscriptions/`(account)`/`(name)`/Rules`

  Return all rules of a given subscription id.

  Parameters: | account – The account name. name – The subscription name.
  Response Headers:
  | Content-Type – application/x-json-stream
  Status Codes: | 200 OK – OK. 401 Unauthorized – Invalid Auth Token. 404 Not Found – Rule Not Found. 404 Not Found – Subscription Not Found. 500 Internal Server Error – Internal Error.
  Returns: | Line separated list of dictionaries with rule information.