Resource: Subscriptions

Topics:

Actions

  • - (Object) index(method = GET)

Url:

  • [GET] /rest/v1/account/subscriptions? (user access)
  • [GET] /rest/v1/accounts/:account_id/subscriptions? (admin access)
Note:

This action requires a cookie session with either admin or user rights. See the documentation for REST Sessions for more information.

Returns a list of subscriptions

Arguments:

  • (DateTime) updated_at_from

    (optional) Filters by start of updated_at field.

  • (DateTime) updated_at_to

    (optional) Filters by end of updated_at field.

Example Request:

[User Access]
The following URL returns the information for all subscriptions on the current user account 
https://service_name.synctv.com/rest/v1/account/subscriptions

Example Response:

[User Access]
<ssap>
  <response>
    <count>1</count>
    <code>1</code>
    <message>Successfully completed.</message>
  </response>
  <subscriptions>
    <subscription>
      <status>active</status>
      <price type="decimal">0.0</price>
      <created_at type="datetime">2011-11-16T00:22:28Z</created_at>
      <updated_at type="datetime">2011-11-16T00:22:28Z</updated_at>
      <linked_subscription_id nil="true"></linked_subscription_id>
      <starts_on type="date">2011-11-15</starts_on>
      <billing_cycle nil="true"></billing_cycle>
      <account_id type="integer">668</account_id>
      <id type="integer">100</id>
      <subscribable_type>Service</subscribable_type>
      <renews_on nil="true"></renews_on>
      <subscribable_id type="integer">737</subscribable_id>
      <ends_on nil="true"></ends_on>
      <cancels_on nil="true"></cancels_on>
      <offer_id type="integer"></offer_id>  
    </subscription>
  </subscriptions>
  <version>0.5</version>
</ssap>
  • - (Object) index(method = GET)

Url:

  • [GET] /rest/v1/account/subscriptions/:id (user access)
  • [GET] /rest/v1/accounts/:account_id/subscriptions/:id (admin access)
Note:

This action requires a cookie session with either admin or user rights. See the documentation for REST Sessions for more information.

Returns information for an account subscription

Example Request:

[User Access]
The following URL returns the subscription information for the current user account with subscription id == 100 
https://service_name.synctv.com/rest/v1/account/subscriptions/100

Example Response:

[User Access]
<ssap>
  <response>
    <count>1</count>
    <code>1</code>
    <message>Successfully completed.</message>
  </response>
  <version>0.5</version>
  <subscription>
    <status>active</status>
    <price type="decimal">0.0</price>
    <created_at type="datetime">2011-11-16T00:22:28Z</created_at>
    <updated_at type="datetime">2011-11-16T00:22:28Z</updated_at>
    <linked_subscription_id nil="true"></linked_subscription_id>
    <starts_on type="date">2011-11-15</starts_on>
    <billing_cycle nil="true"></billing_cycle>
    <account_id type="integer">668</account_id>
    <id type="integer">100</id>
    <subscribable_type>Service</subscribable_type>
    <renews_on nil="true"></renews_on>
    <subscribable_id type="integer">737</subscribable_id>
    <ends_on nil="true"></ends_on>
    <cancels_on nil="true"></cancels_on>
    <offer_id type="integer"></offer_id>
  </subscription>
</ssap>
  • - (Object) destroy(method = DELETE)

Url:

  • [DELETE] /rest/v1/account/subscriptions/:id (user access)
  • [DELETE] /rest/v1/accounts/:account_id/subscriptions/:id (admin access)
Note:

This action requires a cookie session with either admin or user rights. See the documentation for REST Sessions for more information.

Note:

By default the subscription is set to cancel on the next ‘renews_on’ date. If ‘renews_on’ is nil, the subscription is canceled immediately.

Cancels a subscription

Example Request:

[User Access]
The following URL cancels the subscription for the current user account with subscription id == 100 
[DELETE] https://service_name.synctv.com/rest/v1/account/subscriptions/100

Example Response:

[User Access]
<ssap>
  <response>
    <count>1</count>
    <code>1</code>
    <message>Successfully completed.</message>
  </response>
  <subscription>
    <status>cancelled</status>
    <price type="decimal">0.0</price>
    <created_at type="datetime">2011-11-16T00:22:28Z</created_at>
    <updated_at type="datetime">2011-11-16T00:22:28Z</updated_at>
    <linked_subscription_id nil="true"></linked_subscription_id>
    <starts_on type="date">2011-11-15</starts_on>
    <billing_cycle nil="true"></billing_cycle>
    <account_id type="integer">668</account_id>
    <id type="integer">100</id>
    <subscribable_type>Service</subscribable_type>
    <renews_on nil="true"></renews_on>
    <subscribable_id type="integer">737</subscribable_id>
    <ends_on nil="true"></ends_on>
    <cancels_on nil="true"></cancels_on>
    <offer_id type="integer"></offer_id> 
  </subscription>
  <version>0.5</version>
</ssap>