Resource: Promo Codes

Topics:

Actions

  • - (Object) index

Url:

  • [GET] /rest/v1/offers/:offer_id/promo_codes?[arguments]
Note:

This action requires a cookie session with admin rights. See the documentation for REST Session for more information.

Note:

Promo codes are relative to an offer as identified by :offer_id in the request URL

Returns a list of promo codes

Arguments:

  • (Boolean) consumed

    (optional) Returns consumed promo codes when ‘true’ and unconsumed promo codes when ‘false’ [default: returns all consumed and unconsumed promo codes].

Example Request:

The following URL returns all consummed promo codes for offer ID == 2
https://service_name.synctv.com/rest/v1/offers/2/promo_codes?consumed=true

Example Response:

<ssap>
  <response>
    <count>100</count>
    <code>1</code>
    <message>Successfully completed.</message>
  </response>
  <promo_codes type="array">
    <promo_code>
      <id>31</id>
      <created_at>2012-06-21T18:08:08Z</created_at>
      <code>mGbMKQ</code>
      <offer_id>2</offer_id>
      <consumed_on>2011-12-19T14:21:18Z</consumed_on>
      <consumed_by>2365</consumed_by>
    </promo_code>
    <promo_code>
      <id>32</id>
      <created_at>2012-06-21T18:08:08Z</created_at>
      <code>mGbMKQ</code>
      <offer_id>3</offer_id>
      <consumed_on>2011-12-19T14:21:18Z</consumed_on>
      <consumed_by>2366</consumed_by>
    </promo_code>
  </promo_codes>
  <version>0.5</version>
</ssap>

Response Fields:

  • (Array) promo_codes

    A list of promo codes. See below for a description of promo code fields.

  • - (Object) show

Url:

  • [GET] /rest/v1/offers/:offer_id/promo_codes/:id?[arguments]
Note:

This action requires a cookie session with admin rights. See the documentation for REST Session for more information.

Note:

Promo codes are relative to an offer as identified by :offer_id in the request URL

Returns information for a single promo code

Example Request:

The following URL returns the information for promo code with ID == 31
https://service_name.synctv.com/rest/v1/offers/2/promo_codes/31

Example Response:

<ssap>
  <promo_code>
    <id>31</id>
    <created_at>2012-06-21T18:08:08Z</created_at>
    <code>mGbMKQ</code>
    <offer_id>2</offer_id>
    <consumed_on>2011-12-19T14:21:18Z</consumed_on>
    <consumed_by>2365</consumed_by>
  </promo_code>
  <response>
    <count>1</count>
    <code>1</code>
    <message>Successfully completed.</message>
  </response>
  <version>0.5</version>
</ssap>

Response Fields:

  • (Number) id

    The id of the promo code record.

  • (Timestamp) created_at

    The date/time the promo code was created (in iso8601 format).

  • (String) code

    The promo code value.

  • (Integer) offer_id

    The ID of the offer the promo code belongs to.

  • (Timestamp) consumed_on

    The date/time the promo code was consumed (in iso8601 format). This field is empty if the promo code has not been consumed.

  • (Integer) consumed_by

    The ID of the account that consumed the promo code. This field is empty if the promo code has not been consumed.

  • - (Object) create

Url:

  • [POST] /rest/v1/offers/:offer_id/promo_codes?[arguments]
Note:

This action requires a cookie session with admin rights. See the documentation for REST Session for more information.

Note:

Promo codes are relative to an offer as identified by :offer_id in the request URL

Note:

Promo codes will be unique across the service

Creates promo code(s)

Arguments:

  • (Integer) count

    The number of promo codes to generate. [min == 1 (default), max == 100]

  • (Integer) length

    The number of characters for each promo code. [min == 6 (default), max == 10]

Example Request:

The following URL generates 10 promo codes that are 8 characters in length
https://service_name.synctv.com/rest/v1/offers/1020/promo_codes?count=10&length=8

Example Response:

<ssap>
  <response>
    <count>1</count>
    <code>1</code>
    <message>Successfully completed.</message>
  </response>
  <version>0.5</version>
</ssap>

Response Fields:

  • (Integer) code

    Response code [1 == success].

  • (String) message

    Response message.

  • (String) count

    Number of items returned. Should be 0.

  • - (Object) validate

Url:

  • [GET] /rest/v1/promo_codes/validate?[arguments]
Note:

This action does not require a cookie session. If there is no cookie session then the device id parameter is required.

Validates a promo code across the service.

Arguments:

  • (String) device

    The id of the service device (only required if no cookie session)

  • (String) code

    The value of the promo code to be validated

Example Request:

The following URL validate a promo_code with a code value == 1A2B3C 
https://service_name.synctv.com/rest/v1/promo_codes/validate?device=urn:synctv:devices:web:11223344&code=1A2B3C

Example Response:

<ssap>
  <response>
    <code>1</code>
    <message>Successfully completed</message>
    <count>0</count>
  </response>
</ssap>

Response Fields:

  • (Integer) code

    Response code. 1 indicates the promo code is valid and has not been consumed. -45 indicates the promo code is invalid or has been consumed.

  • (String) message

    Response message.

  • (String) count

    Number of items returned. Should be 0.