downloadables

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.

Interact with this resource

To interact with this resource and see it in the context of the API, you can utilise Postman or your Terminal/Console to perform requests. If you have a Foxy store, you can also use the API browser in the admin to interact with resources connected to your store.

Actions

GET
View a list of downloadables
POST
Create a new downloadable
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:downloadables": [...]
  },
  "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/downloadable">
  ...
  </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: downloadable

Description

Downloadables are items configured directly in Foxy for users to purchase and download. When creating a downloadable, you'll also send the file directly. Additionally, the downloadable must have a item_category_uri of an item_category which is configured for downloaded item delivery.

To create a downloadable, you need to POST a file with the value being the downloadble file you want to create. Here is an example using curl:

curl -H "FOXY-API-VERSION: 1" -H "Authorization: Bearer 61a7197472c9f9e4481f2d2f6a7d0352" -F "code=unicorn" -i -F "name=Unicorn" -F "file=@/Users/lukestokes/Pictures/temp/unicorn_web.png" -F "price=10" -F "item_category_uri=https://api-sandbox.foxycart.com/item_categories/307" https://api-sandbox.foxycart.com/stores/8/downloadables

You can also update an existing downloadable file using the file property, but you may also need to include the X-HTTP-Method-Override: PATCH header since our server expects a PATCH or a PUT when updating an existing resource. Here's an example using curl:

curl -H "X-HTTP-Method-Override: PATCH" -H "FOXY-API-VERSION: 1" -H "Authorization: Bearer 61a7197472c9f9e4481f2d2f6a7d0352" -F "file=@/Users/lukestokes/Pictures/temp/1209_mcmillan_630x420.jpg" https://api-sandbox.foxycart.com/downloadables/40

Interact with this resource

To interact with this resource and see it in the context of the API, you can utilise Postman or your Terminal/Console to perform requests. If you have a Foxy store, you can also use the API browser in the admin to interact with resources connected to your store.

Actions

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

Properties

Property Description Type Constraints
item_category_uri The full API URI of the item category this product is part of. The item category must have an item delivery type of downloaded. URL Required. Obtained from the self link relation of an item category.
name The name of this downloadable. This will be shown to the customer in the cart. String Required. 100 characters or less.
code The code for this downloadable. When adding this item to the cart, this is the code which will be used. String Required. 50 characters or less.
price The item total for this downloadable. This is the amount the customer will pay to purchased this downloadable item. Decimal Greater than or equal to 0.
file_name The name of the file uploaded to our server. This is originally set when creating a downloadable with the file property. String Read only
file_size The size of the file uploaded to our server. This is originally set when creating a downloadable with the file property. Integer Read only
upload_date The date this file was last uploaded. Date 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-sandbox.foxycart.com/downloadables/40",
            "title": "This Downloadable"
        },
        "fx:store": {
            "href": "https://api-sandbox.foxycart.com/stores/8",
            "title": "This Store"
        },
        "fx:item_category": {
            "href": "https://api-sandbox.foxycart.com/item_categories/307",
            "title": "Item Category for this downloadable"
        },
        "fx:downloadable_item_categories": {
            "href": "https://api-sandbox.foxycart.com/stores/8/item_categories?item_delivery_type=downloaded",
            "title": "Downloadable Item Categories for this store"
        }
    },
    "item_category_uri": "https://api-sandbox.foxycart.com/item_categories/307",
    "name": "Unicorn",
    "code": "unicorn",
    "price": 10,
    "file_name": "unicorn_web.png",
    "file_size": 267069,
    "upload_date": "2015-04-16T09:33:28-0700",
    "date_created": "2015-04-16T09:33:28-0700",
    "date_modified": "2015-04-16T09:46:46-0700"
}
<?xml version="1.0" encoding="UTF-8"?>
<resource href="https://api-sandbox.foxycart.com/downloadables/40" rel="https://api.foxycart.com/rels/downloadable">
  <link rel="self" href="https://api-sandbox.foxycart.com/downloadables/40" title="This Downloadable"/>
  <link rel="https://api.foxycart.com/rels/store" href="https://api-sandbox.foxycart.com/stores/8" title="This Store"/>
  <link rel="https://api.foxycart.com/rels/item_category" href="https://api-sandbox.foxycart.com/item_categories/307" title="Item Category for this downloadable"/>
  <link rel="https://api.foxycart.com/rels/downloadable_item_categories" href="https://api-sandbox.foxycart.com/stores/8/item_categories?item_delivery_type=downloaded" title="Downloadable Item Categories for this store"/>
  <item_category_uri>https://api-sandbox.foxycart.com/item_categories/307</item_category_uri>
  <name>Unicorn</name>
  <code>unicorn</code>
  <price>10</price>
  <file_name>unicorn_web.png</file_name>
  <file_size>267069</file_size>
  <upload_date>2015-04-16T09:33:28-0700</upload_date>
  <date_created>2015-04-16T09:33:28-0700</date_created>
  <date_modified>2015-04-16T09:46:46-0700</date_modified>
</resource>
{
    "class": [
        "downloadable"
    ],
    "properties": {
        "item_category_uri": "https://api-sandbox.foxycart.com/item_categories/307",
        "name": "Unicorn",
        "code": "unicorn",
        "price": 10,
        "file_name": "unicorn_web.png",
        "file_size": 267069,
        "upload_date": "2015-04-16T09:33:28-0700",
        "date_created": "2015-04-16T09:33:28-0700",
        "date_modified": "2015-04-16T09:46:46-0700"
    },
    "links": [
        {
            "rel": [
                "self"
            ],
            "href": "https://api-sandbox.foxycart.com/downloadables/40"
        },
        {
            "rel": [
                "https://api.foxycart.com/rels/store"
            ],
            "href": "https://api-sandbox.foxycart.com/stores/8"
        },
        {
            "rel": [
                "https://api.foxycart.com/rels/item_category"
            ],
            "href": "https://api-sandbox.foxycart.com/item_categories/307"
        },
        {
            "rel": [
                "https://api.foxycart.com/rels/downloadable_item_categories"
            ],
            "href": "https://api-sandbox.foxycart.com/stores/8/item_categories?item_delivery_type=downloaded"
        }
    ]
}

Zoomable Resources

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