REST API

Usage

You can use the CloudApp API to list your items, upload a file, or create a bookmark.

HTTP Digest is used to authenticate all requests.

You're probably interested in JSON responses and not HTML. Add the header Accept: application/json on requests to receive JSON and Content-Type: application/json when you're sending JSON.

The usage of the CloudApp API is bound to our Terms Of Service.

Items

Items are anything you can create with CloudApp: files and bookmarks. Below are the actions you can take to view, create, and delete your items.

View An Item By Short URL

Get metadata about a cl.ly URL like name, type, or view count.

Request

Response

  • Status: 200 OK
  • Body:

    {
      "href": "http://my.cl.ly/items/3",
      "name": "Screen shot 2010-04-01 at 12.00.00 AM.png",
      "url": "http://cl.ly/6571",
      "content_url": "http://cl.ly/6571/content",
      "item_type": "image",
      "view_counter": 42,
      "icon": "http://my.cl.ly/images/item_types/image.png",
      "remote_url":"http://f.cl.ly/items/3d7ba41682802c301150/Screen shot 2010-04-01 at 12.00.00 AM.png",
      "created_at": "2010-04-01T12:00:00Z",
      "updated_at": "2010-04-01T12:00:00Z"
    }
    

List Items

Page through your items. For the best performance, make sure your requests:

When used correctly, the HTTP library you use should take care of this for you.

Request

  • Requires Authentication
  • HTTP Method: GET
  • URL: http://my.cl.ly/items
  • Optional paramters:
    • page=1: Page number starting at 1.
    • per_page=5: Number of items per page.
    • type=image: Filter items by type (image, bookmark, text, archive, audio, video, or unknown).
    • deleted=true: Show trashed items.

Response

  • Status: 200 OK
  • Body:

    [{
      "href": "http://my.cl.ly/items/1",
      "name": "CloudApp",
      "url": "http://cl.ly/d837",
      "item_type": "bookmark",
      "view_counter": 42,
      "icon": "http://my.cl.ly/images/item_types/bookmark.png",
      "redirect_url": "http://getcloudapp.com",
      "created_at": "2010-04-01T12:00:00Z",
      "updated_at": "2010-04-01T12:00:00Z"
    }, {
      "href": "http://my.cl.ly/items/2",
      "name": "Google",
      "url": "http://cl.ly/5f9c",
      "item_type": "bookmark",
      "view_counter": 24,
      "icon": "http://my.cl.ly/images/item_types/bookmark.png",
      "redirect_url": "http://google.com",
      "created_at": "2010-04-01T12:00:00Z",
      "updated_at": "2010-04-01T12:00:00Z"
    }, {
      "href": "http://my.cl.ly/items/3",
      "name": "Screen shot 2010-04-01 at 12.00.00 AM.png",
      "url": "http://cl.ly/6571",
      "content_url": "http://cl.ly/6571/content",
      "item_type": "image",
      "view_counter": 42,
      "icon": "http://my.cl.ly/images/item_types/image.png",
      "remote_url":"http://f.cl.ly/items/3d7ba41682802c301150/Screen shot 2010-04-01 at 12.00.00 AM.png",
      "created_at": "2010-04-01T12:00:00Z",
      "updated_at": "2010-04-01T12:00:00Z"
    }]
    

Create A Bookmark

Request

  • Requires Authentication
  • HTTP Method: POST
  • URL: http://my.cl.ly/items
  • Body:

    {
      "item": {
        "name": "CloudApp",
        "redirect_url": "http://cloudapp.com"
      }
    }
    

Response

  • Status: 200 OK
  • Body:

    {
      "href": "http://my.cl.ly/items/1",
      "name": "CloudApp",
      "url": "http://cl.ly/d837",
      "item_type": "bookmark",
      "view_counter": 0,
      "icon": "http://my.cl.ly/images/item_types/bookmark.png",
      "redirect_url": "http://getcloudapp.com",
      "created_at": "2010-04-01T12:00:00Z",
      "updated_at": "2010-04-01T12:00:00Z"
    }
    

Upload A File

Files are uploaded directly to S3 to be as fast as possible. You'll need to request a few parameters from CloudApp and send them along with the file.

Request

Response

  • Status: 200 OK
  • Body:

    {
      "url": "http://f.cl.ly",
      "params": {
        "AWSAccessKeyId": "AKIAIDPUZISHSBEOFS6Q",
        "key": "items/qL/${filename}",
        "acl": "public-read",
        "success_action_redirect": "http://my.cl.ly/items/s3",
        "signature": "2vRWmaSy46WGs0MDUdLHAqjSL8k=",
        "policy": "eyJleHBpcmF0aW9uIjoiMjAxMC0wNC0wMVQwMDowMDowMFoiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJsaW5lYnJlYWstdGVzdCJ9LHsiYWNsIjoicHVibGljLXJlYWQifSx7InN1Y2Nlc3NfYWN0aW9uX3JlZGlyZWN0IjoiaHR0cDovL215LmNsb3VkYXBwLmxvY2FsL3VwbG9hZHMvczMifSxbInN0YXJ0cy13aXRoIiwiJGtleSIsInVwbG9hZHMvcUwvIl1dfQ=="
      }
    }
    

Use this response to construct the upload. Each item in params becomes a separate parameter you'll need to post to url. Send the file as the parameter file.

Amazon's documentation says any parameter after file is ignored. Make sure file is the last parameter or the upload will be rejected.

Request

  • HTTP Method: POST
  • URL: http://f.cl.ly (Value of url in response.)
  • Post each key and value from params as a separate parameter.
  • Post the file data as the parameter file.

Response

Request

Response

  • Status: 200 OK
  • Body:

    {
      "href": "http://my.cl.ly/items/3",
      "name": "Screen shot 2010-04-01 at 12.00.00 AM.png",
      "url": "http://cl.ly/6571",
      "content_url": "http://cl.ly/6571/content",
      "item_type": "image",
      "view_counter": 0,
      "icon": "http://my.cl.ly/images/item_types/image.png",
      "remote_url":"http://f.cl.ly/items/3d7ba41682802c301150/Screen shot 2010-04-01 at 12.00.00 AM.png",
      "created_at": "2010-04-01T12:00:00Z",
      "updated_at": "2010-04-01T12:00:00Z"
    }
    

Delete An Item

Request

Response

  • Status: 200 OK