coupon_codes

Description

This link relationship returns a collection of resources. You can easily paginate through this collection using the hypermedia links provided and the link relationships of first, prev, next, and last. Scroll down to view a representation of a single resource embedded within this collection.

Sandbox Example

You can interact with this resource and run actions against the sandbox API via our HAL Brower.

Actions

GET
View a list of coupon_codes
POST
Create a new coupon_code
HEAD
Get just the header response
OPTIONS
Get a response explaining which HTTP methods are supported

Example Representation

{
  "_links": {
    "curies": [
      {
        "name": "fx",
        "href": "https://api.foxycart.com/rels/{rel}",
        "templated": true
      }
    ],
    "self": {
      "href": "...",
      "title": "This Collection"
    },
    "first": {
      "href": "...?offset=0",
      "title": "First Page of this Collection"
    },
    "prev": {
      "href": "...?offset=0",
      "title": "Previous Page of this Collection"
    },
    "next": {
      "href": "...?offset=0",
      "title": "Next Page of this Collection"
    },
    "last": {
      "href": "...?offset=0",
      "title": "Last Page of this Collection"
    }
  },
  "_embedded": {
    "fx:coupon_codes": [...]
  },
  "total_items": "5",
  "returned_items": 5,
  "limit": 20,
  "offset": 0
}
<?xml version="1.0" encoding="UTF-8"?>
<resource href="...">
  <link rel="self" href="..." title="This Collection"/>
  <link rel="first" href="...?offset=0" title="First Page of this Collection"/>
  <link rel="prev" href="...?offset=0" title="Previous Page of this Collection"/>
  <link rel="next" href="...?offset=0" title="Next Page of this Collection"/>
  <link rel="last" href="...?offset=0" title="Last Page of this Collection"/>
  <resource href="..." rel="https://api.foxycart.com/rels/coupon_code">
  ...
  </resource>
  <total_items>5</total_items>
  <returned_items>5</returned_items>
  <limit>20</limit>
  <offset>0</offset>
</resource>
{
    "properties": {
        "total_items": "5",
        "returned_items": 5,
        "limit": 20,
        "offset": 0
    },
    "entities": [...],
    "links": [
        {
            "rel": [
                "self"
            ],
            "href": "..."
        },
        {
            "rel": [
                "first"
            ],
            "href": "...?offset=0"
        },
        {
            "rel": [
                "prev"
            ],
            "href": "...?offset=0"
        },
        {
            "rel": [
                "next"
            ],
            "href": "...?offset=0"
        },
        {
            "rel": [
                "last"
            ],
            "href": "...?offset=0"
        }
    ],
    "actions": [
    ]
}

Embedded Resource: coupon_code

Description

Coupon codes are configured for each coupon you set up. They are unique codes to be used by your customers to obtain the coupon's discount.

If you would like to create multiple coupon codes at once, see the coupon documentation.

Sandbox Example

You can interact with this resource and run actions against the sandbox API via our HAL Brower.

Actions

GET
View a coupon_code
PATCH
Update a coupon_code (send only the properties you want to modify)
PUT
Replace a coupon_code (send the entire representation)
DELETE
Delete a coupon_code
HEAD
Get just the header response
OPTIONS
Get a response explaining which HTTP methods are supported

Properties

Property Description Type Constraints
code The string value of this coupon code which your customer will add to their cart to use this coupon. String Required. 50 characters or less.
number_of_uses_to_date For informational purposes, this shows you how many times this coupon code has already been used. Integer Read Only
date_created The date this resource was created. Date Read only
date_modified The date this resource was last modified. Date Read only

Example Representation

{
    "_links": {
        "curies": [
            {
                "name": "fx",
                "href": "https://api.foxycart.com/rels/{rel}",
                "templated": true
            }
        ],
        "self": {
            "href": "https://api.foxycart.com/coupon_codes/6540",
            "title": "test"
        },
        "fx:store": {
            "href": "https://api.foxycart.com/stores/66",
            "title": "This Store"
        },
        "fx:coupon": {
            "href": "https://api.foxycart.com/coupons/244",
            "title": "This Coupon"
        },
        "fx:coupon_code_transactions": {
            "href": "https://api.foxycart.com/coupon_codes/6540/transactions",
            "title": "Transactions using this Coupon Code"
        }
    },
    "code": "test",
    "number_of_uses_to_date": 31,
    "date_created": null,
    "date_modified": null
}
<?xml version="1.0" encoding="UTF-8"?>
<resource href="https://api.foxycart.com/coupon_codes/6540" rel="https://api.foxycart.com/rels/coupon_code">
  <link rel="self" href="https://api.foxycart.com/coupon_codes/6540" title="test"/>
  <link rel="https://api.foxycart.com/rels/store" href="https://api.foxycart.com/stores/66" title="This Store"/>
  <link rel="https://api.foxycart.com/rels/coupon" href="https://api.foxycart.com/coupons/244" title="This Coupon"/>
  <link rel="https://api.foxycart.com/rels/coupon_code_transactions" href="https://api.foxycart.com/coupon_codes/6540/transactions" title="Transactions using this Coupon Code"/>
  <code>test</code>
  <number_of_uses_to_date>31</number_of_uses_to_date>
  <date_created></date_created>
  <date_modified></date_modified>
</resource>
{
    "class": [
        "coupon_code"
    ],
    "properties": {
        "code": "test",
        "number_of_uses_to_date": 31,
        "date_created": null,
        "date_modified": null
    },
    "links": [
        {
            "rel": [
                "self"
            ],
            "href": "https://api.foxycart.com/coupon_codes/6540"
        },
        {
            "rel": [
                "https://api.foxycart.com/rels/store"
            ],
            "href": "https://api.foxycart.com/stores/66"
        },
        {
            "rel": [
                "https://api.foxycart.com/rels/coupon"
            ],
            "href": "https://api.foxycart.com/coupons/244"
        },
        {
            "rel": [
                "https://api.foxycart.com/rels/coupon_code_transactions"
            ],
            "href": "https://api.foxycart.com/coupon_codes/6540/transactions"
        }
    ]
}

Zoomable Resources

This resource has no linked resources which can be "zoomed" in on, filtered and embedded within this resource.