FetchApp API

Get list of all downloads for a product October 06 2015

GET to list all downloads for the specified product...

/api/v2/products/:sku/downloads
/api/v2/products/:sku/downloads.xml

Example result...

<?xml version="1.0" encoding="UTF-8"?>
<downloads type="array">
    <download>
        <id>233</id>
        <filename>photo.jpg</filename>
        <product_sku>BILL-WAX</product_sku>
        <order_id>1001</order_id>
        <order_item_id>821431</order_item_id>
        <ip_address>127.0.0.1</ip_address>
        <downloaded_at type="datetime">2009-04-27T04:13:09+00:00</downloaded_at>
        <size_bytes type="float">87088
        </size_bytes>
    </download>
    <download>
        <id>433</id>
        <filename>ebook.pdf</filename>
        <product_sku>BILL-WAX</product_sku>
        <order_id nil="true"></order_id>
        <order_item_id nil="true"></order_item_id>
        <ip_address>127.0.0.1</ip_address>
        <downloaded_at type="datetime">2009-04-28T10:33:09+00:00</downloaded_at>
        <size_bytes type="float">332088
        </size_bytes>
    </download>
</downloads>

A nil order_id or order_item_id indicates a direct download of the product via the permalink.


Get list of files for product October 06 2015

GET to list all files for the specified product...

/api/v2/products/:sku/files
/api/v2/products/:sku/files.xml

Example result...

<?xml version="1.0" encoding="UTF-8"?>
<files type="array">
    <file>
        <id>123</id>
        <filename>Part1.zip</filename>
        <size_bytes type="integer">9774173559</size_bytes>
        <content_type>binary/octet-stream</content_type>
        <permalink href="http://demo.fetchapp.com/permalink/yuurud">/permalink/yuurud</permalink>
        <url nil="true"></url>
    </file>
    <file>
        <id>432</id>
        <filename>External File Name</filename>
        <size_bytes nil="true"></size_bytes>
        <content_type nil="true"></content_type>
        <permalink href="http://demo.fetchapp.com/permalink/werwa">/permalink/werwa</permalink>
        <url>http://your.cdn.com/link/to/file</url>
    </file>
</files>

For files stored in FetchApp, the url will be nil. For files stored externally the size_bytesand content_type will be nil since this information isn't available.


Get statistics about a product October 06 2015

GET statistics about a product...

/api/v2/products/:sku/stats
/api/v2/products/:sku/stats.xml

For example...

<?xml version="1.0" encoding="UTF-8"?>
<product>
    <id>0001</id>
    <sku>0001</sku>
    <price type="float">0.01</price>
    <currency>USD</currency>
    <download_count>14</download_count>
    <order_count>14</order_count>
</product>

Delete a Product October 06 2015

Delete the specified product...

/api/v3/products/:id

This will also remove the product from any existing orders.

 


Update a Product October 06 2015

PUT to update the specified product...

/api/v3/products/:id

For example...

{
  "product": {
    "currency": "USD",
    "download_count": 2,
    "item_urls": [
      {
                 "created_at": "2021-09-12T12:34:55Z",
                 "download_count": 2,
                 "id": 3088243,
                 "name": "Download Link",
                 "updated_at": "2021-09-13T10:11:12Z",
                 "url": "http://www.example.com"
      }
    ],
    "name": "My Product",
    "orders_count": 1,
    "price": 10.99,
    "sku": "ABC123"
  }
}

The SKU can be changed if necessary.


Get details of the specified product October 06 2015

GET details of the specified product...

/api/v3/products/:id

Example result...

{
  "product": {
    "created_at": "2021-09-12T12:34:55Z",
    "currency": "USD",
    "download_count": 2,
    "id": 123,
    "item_urls": [
      {
                 "created_at": "2021-09-12T12:34:55Z",
                 "download_count": 2,
                 "id": 3088243,
                 "name": "Download Link",
                 "updated_at": "2021-09-13T10:11:12Z",
                 "url": "http://www.example.com"
      }
    ],
    "name": "My Product",
    "orders_count": 1,
    "price": 10.99,
    "sku": "ABC123",
    "updated_at": "2021-09-13T10:11:12Z"
  }
}

Get a List of your Products October 06 2015

GET a list all your products...

/api/v3/products
/api/v3/products?page=2

Example result...

{
  "products": [
    {
            "created_at": "2021-09-12T12:34:55Z",
            "currency": "USD",
            "download_count": 2,
            "id": 123,
            "item_urls": [
        {
                "created_at": "2021-09-12T12:34:55Z",
                "download_count": 2,
                "id": 3088243,
                "name": "Download Link",
                "updated_at": "2021-09-13T10:11:12Z",
                "url": "http://www.example.com"
        }
      ],
            "name": "My Product",
            "orders_count": 1,
            "price": 10.99,
            "sku": "ABC123",
            "updated_at": "2021-09-13T10:11:12Z"
    }
  ]
}

Get Order Items October 06 2015

GET a list of all order items for the specified order...

/api/v2/orders/:id/order_items
/api/v2/orders/:id/order_items.xml

Example result...

<?xml version="1.0" encoding="UTF-8"?>
<order_items type="array">
  <order_item>
    <id type="integer">821431</id>
    <sku>BILL-WAX</sku>
    <order_id>1001</order_id>
    <product_name>Quality Bill Wax</product_name>
    <price type="float">5.00</price>
    <download_count type="integer">2</download_count>
    <custom_1 nil="true"></custom_1>
    <custom_2 nil="true"></custom_2>
    <custom_3 nil="true"></custom_3>
    <license_key nil="true"></license_key>
    <created_at type="datetime">2012-08-01T15:54:06Z</created_at>
    <files_uri>https://demo.fetchapp.com/api/v2/orders/1001/order_items/821431/files</files_uri>
    <downloads_uri>https://demo.fetchapp.com/api/v2/orders/1001/order_items/821431/downloads</downloads_uri>
  </order_item>
</order_items>

Order Statistics October 06 2015

GET statistics about an order...

/api/v2/orders/:id/stats
/api/v2/orders/:id/stats.xml

For example...

<?xml version="1.0" encoding="UTF-8"?>
<order>
    <id>1001</id>
    <vendor_id>1554898798</vendor_id>
    <download_count type="integer">1</download_count>
    <product_count type="integer">1</product_count>
    <total type="float">44.50</total>
    <currency>USD</currency>
</order>

 


Send Order Email October 06 2015

POST to send download email for the specified order...

/api/v2/orders/:id/send_email?reset_expiration=false
/api/v2/orders/:id/send_email?expiration_date=2011-03-07T15:08:02+00:00&download_limit=10
/api/v2/orders/:id/send_email.xml?expiration_date=2011-03-07T15:08:02+00:00&download_limit=10

Example result...

<?xml version="1.0" encoding="UTF-8"?>
<message>Ok.</message>

NOTE: reset_expiration is an optional boolean, and defaults to true if not present. If true, the expiration date will be set to whatever is selected in Settings → General or provided by the param expiration_date and the download limit will be set to whatever is selected in Settings → General or download_limit if present. Bothexpiration_date and download_limit are optional and if present override the default values option.


Expire an Order October 06 2015

GET to expire the specified order...

/api/v2/orders/:id/expire
/api/v2/orders/:id/expire.xml

Example result...

<?xml version="1.0" encoding="UTF-8"?>
<message>Ok.</message>

List Order Downloads October 06 2015

GET to list all downloads for the specified order...

/api/v2/orders/:id/downloads
/api/v2/orders/:id/downloads.xml

Example result...

<?xml version="1.0" encoding="UTF-8"?>
<downloads type="array">
    <download>
        <id>233</id>
        <filename>photo.jpg</filename>
        <product_sku>BILL-WAX</product_sku>
        <order_id>1001</order_id>
        <ip_address>127.0.0.1</ip_address>
        <downloaded_at type="datetime">2009-04-27T04:13:09+00:00</downloaded_at>
        <size_bytes type="float">87088
        </size_bytes>
    </download>
    <download>
        <id>433</id>
        <filename>ebook.pdf</filename>
        <product_sku>BILL-WAX</product_sku>
        <ip_address>127.0.0.1</ip_address>
        <downloaded_at type="datetime">2009-04-28T10:33:09+00:00</downloaded_at>
        <size_bytes type="float">332088
        </size_bytes>
    </download>
</downloads>


Delete an Order October 06 2015

DELETE the specified order...

/api/v3/orders/:id

Example result...

{
     "order": {
             "created_at": "2021-09-12T12:34:55Z",
             "custom_order_id": "O123",
             "email": "joe@example.com",
             "first_name": "John",
             "id": 123,
             "last_name": "Doe",
             "updated_at": "2021-09-13T10:11:12Z"
     }
}

Update an Order October 06 2015

PUT to update the specified order...

/api/v3/orders/:id

For example...

{
     "order": {
             "custom_order_id": "O123",
             "email": "joe@example.com",
             "first_name": "John",
             "last_name": "Doe"
     }
}

NOTE: price is optional and defaults to the price set in the UI if not present.send_email is optional and defaults to false if not present. All fields can be changed including the order ID.


Post a new order October 06 2015

POST to create an order...

/api/v3/orders

For example...

{
"order": {
"custom_order_id": "O123",
"email": "joe@example.com",
"first_name": "John",
"last_name": "Doe"
}
}

NOTE: price is optional and defaults to the price set in the UI if not present.send_email is optional and defaults to true if not present. expiration_date is optional and the default is the setting in Settings → General if not present. download_limit is optional and the default is the setting in Settings → General if not present.downloads_remaining is optional and serves as an override. If not present the default is whatever the order's download_limit is set to.


Get Specific Order October 06 2015

GET details of the specified order...

/api/v3/orders/:id

Example result...

{
  "order": {
          "created_at": "2021-09-12T12:34:55Z",
          "custom_order_id": "O123",
          "email": "joe@example.com",
          "first_name": "John",
          "id": 123,
          "last_name": "Doe",
          "updated_at": "2021-09-13T10:11:12Z"
  }
}

Get All Orders October 06 2015

GET a list of all your orders...

/api/v3/orders
/api/v3/orders?page=2

Status can be open or expired. If not specified then all orders (open and expired) will be returned. Example result...

{
  "orders": [
    {
            "created_at": "2021-09-12T12:34:55Z",
            "custom_order_id": "O123",
            "email": "joe@example.com",
            "first_name": "John",
            "id": 123,
            "last_name": "Doe",
            "updated_at": "2021-09-13T10:11:12Z"
    }
  ]
}

Files October 06 2015

GET a list of your files...

/api/v3/files
/api/v3/files?page=2

Example result...

{
  "files": [
    {
            "content_type": "",
            "filename": "DL_GP1000-2-2D-Drawing.dxf.zip",
            "id": 823751,
            "size_bytes": 1497938
    },
    {
            "content_type": "",
            "filename": "DL_GP1000-2-2D-Drawing.dxf (1).zip",
            "id": 823752,
            "size_bytes": 1497938
    },
    {
            "content_type": "",
            "filename": "DL_GP1000-1-2D-Drawing.dxf.zip",
            "id": 823753,
            "size_bytes": 1558480
    },
    {
            "content_type": "",
            "filename": "DL_GP1000-2-2D-Drawing.dxf.gtar",
            "id": 823754,
            "size_bytes": 1242113
    }
  ]
}

Downloads October 06 2015

GET a list of your downloads...

/api/v3/downloads
/api/v3/downloads?page=2

Example result...

{
  "downloads": [
    {
            "downloaded_at": "2021-09-12T12:34:55Z",
            "filename": "myfile.txt",
            "id": 123,
            "ip_address": "127.0.0.1",
            "item_sku": "BILL-WAX",
            "order_id": 1002,
            "size_bytes": 314559
    }
  ]
}

NOTE: A nil order_id indicates that the download was from a permalink.


Account October 06 2015

GET information about your account...

/api/v3/account

Example result...

{
  "account": {
          "billing_email": "billing@example.com",
          "created_at": "2021-09-12T12:34:55Z",
          "currency": "USD",
          "email": "support@example.com",
          "first_name": "John",
          "id": 123,
          "last_name": "Doe",
          "name": "My Company",
          "updated_at": "2021-09-13T10:11:12Z",
          "url": "mycompany"
  }
}

GET a new API token (this replaces your existing one)...

/api/v2/new_token
/api/v2/new_token.xml

Example result...

<?xml version="1.0" encoding="UTF-8"?>
<message>abcdef6fdas</message>

Connectivity October 06 2015

GET the time to test connectivity...

GET /api/v2/time
/api/v2/time.xml 

Example result...

<?xml version="1.0" encoding="UTF-8"?>
<time>2013-06-13T10:29:55-05:00</time>

 


Authentication October 06 2015

All requests require basic authentication. To make a proper request, you must set the authorization header of your request and supply the generated string. The string is your personal key and token with a colon ("demokey:demotoken") converted to a base-64 string. For example...

"demokey:demotoken".to_base64 is ZGVtb2tleTpkZW1vdG9rZW4=

Then, place the string into the authorization header of your HTTP requests...

GET /api/v2/orders HTTP/1.1
Host: app.fetchapp.com
Authorization: Basic ZGVtb2tleTpkZW1vdG9rZW4=
Content-Type: application/xml

** Please make sure to set the Content-Type header to 'application/xml'. **


FetchApp API Intro September 16 2015

  • The FetchApp API is implemented as RESTful (using all four verbs GET/POST/PUT/DELETE) over HTTP.  URIs are given with the RESTful option first, followed by alternative paths.

    Every resource, like orders and products, has its own URL and is manipulated in isolation. The API is also usable by non-RESTful platforms as well using GET and POST only by adding on the appropriate command to the URI.

    The following open-source libraries are available: