CubeTree API - For Developers and Programmers

General

Introduction

The CubeTree API is a REST Web services API allowing applications to query and manipulate the resources provided by the CubeTree Web application.

Formats

All resources in the CubeTree API are available in the JSON format when requesting resources. See the JSON page on Wikipedia for more information about JSON. For POST or PUT requests, the request format required is the standard HTTP form encoding described in RFC 2045.

Client Authorization and Security

Client authorization is accomplished via the Login resource (described below). All interactions with the CubeTree API will be over HTTPS to ensure data security.

Rate Limit

In order to provide a high quality of service for all CubeTree API clients, there exists a request rate limit to ensure no one client can overwhelm the system. Each authenticated user account is limited to 30 API requests any given 1 minute period, and 300 total requests per any given 1 hour period, starting from the time of the first eligible request. If your client exceeds this request rate, you will receive an HTTP 509 "Bandwidth Limit Exceeded" response code to indicate this condition.

Versioning

The version of the API is embedded in the URLs of the resources. For example, version 1.0 of the API would be accessed by a set or resources beginning with:

https://www.cubetree.com/api/v1/...

Timestamps

Timestamps will be emitted in UNIX epoch time, i.e. the number of seconds since Jan 1, 1970. The API expects any timestamps in API requests to also be in this format.

Login

Resources

Method URL Description
POST
https://www.cubetree.com/api/v1/login
Acquire authorization to access the API on a member's behalf
POST
https://www.cubetree.com/api/v1/logout
Drop authorization for API access on a member's behalf

Parameters

Note: /api/v1/logout takes no parameters

login=member login email

Login email address for the authenticating member.

password=password

Password for the authenticating member.

Response

The HTTP response for this resource will include a session cookie that should be included on all subsequent requests by the API client in order to prove authentication. There will be no HTTP body on this response.

Retrieving Feed Items

Resources

Method URL Description
GET
https://www.cubetree.com/api/v1/feed
All feed items for the authenticated member
GET
https://www.cubetree.com/api/v1/feed/comments
All comments for the given feed item

Parameters

feed_id=id

Specifies the feed ID with which the particular resource request is interested. If no feed_id is specified, the member's home feed will be assumed. The feed_id parameter can refer to any type of feed specified by the feed_type parameter except the home feed.

feed_type=[ member | group | company ]

Specifies the type of feed referred to in the feed_id parameter. If no feed_type parameter is specified, the target feed will be assumed to be the authenticated member's home feed and any feed_id parameter specified will be ignored.

page=integer >= 1

Specifies the page of results to fetch. This is used to fetch further back in the feed than the latest items.

page_size=integer

Specifies the number of items to fetch. This cannot be > 100 or < 20.

parent_id=integer

Specifies the feed item for which to retrieve comments (only applicable feed/comments resource).

Responses

All of the above requests return the same response representation. Any successful response will return up to 100 items, depending on the value of the page_size parameter.

	[
	  { 
	    "id": 1234567890,
	    "creator-id": 5005,
	    "creator-name": "Frank Schlobatnik",
	    "created-at": 1234567890,
	    "type": "link",
	    "action": "posted the link",
	    "link": "http://cubetree.com/",
	    "link-title": "CubeTree",
	    "blurb": "this app is pretty awesome",
	    "photo": "https://www.cubetree.com/images/this-photo.png",
	    "comments": 1
	  },
	  ...
	]
	

The item response element will have the following attributes:

  • type
    • The type of this feed item. Can be:
      • status
      • link
      • doc
      • photo
      • comment
  • id
    • The ID of the item returned (corresponds to CubeTree™ feed item ID)
  • creator-id
    • The ID of the creator of this feed item
  • creator-name
    • The full name of the creator of this feed item
  • created-at
    • Timestamp of the feed item's creation
  • action
    • Message text for this particular feed item
  • blurb
    • (optional) Blurb text for this feed item
  • photo
    • (optional) Link to a photo associated with this feed item
  • description
    • (optional) Description of the photo associated with this feed item, if applicable
  • link
    • (optional) URL for a link item
  • link-title
    • (optional) title of link for a link item
  • comments
    • (optional) Count of the number of comments associated with this item, if item is commentable

Resources

Method URL Description
POST
https://www.cubetree.com/api/v1/feed/status
Create a new status message for the specified feed
POST
https://www.cubetree.com/api/v1/feed/doc
Create a new doc for the specified feed
POST
https://www.cubetree.com/api/v1/feed/photo
Create a new photo for the specified feed
POST
https://www.cubetree.com/api/v1/feed/comment
Create a new comment for the specified feed item

Parameters

group_id=id

(optional) If specified, this parameter indicates the group ID upon which this new item should be added. Otherwise, it will be submitted to the authenticated member's feed.

parent_id=id

(optional) Specifies the ID of the feed item onto which this new item will be applied. This parameters is only applicable if posting a comment on a feed item and the item is eligible for commenting.

message=message text

The body of the message, HTML-escaped. Currently limited to 255 characters in length and will be truncated to 255 characters if found to be over that limit.

Request Body Format

For doc and photo requests, the actual doc and photo bodies will be uploaded by the client via form-based file upload techniques common to Web applications (see RFC1867 for more details on that). Only the first attachment in a given attempt will be considered. This first attachment must have the label "data" on it.

Retrieving Member Information

Resources

Method URL Description
GET
https://www.cubetree.com/api/v1/members
Retrieve a member's profile information
GET
https://www.cubetree.com/api/v1/members/groups
Retrieve the list of groups a member is following

Parameters

id=id

The member ID for which you are requesting information. Eliding this parameter from the request will return the response object representations for the authenticated member.

Responses

Profile Request
	{
	  "id": 12345,
	  "first-name": "John",
	  "last-name": "Doe",
	  "nick-name": "Awesome",
	  "company-name": "Awesome Widgets LLC",
	  "created-at": 1234567890,
	  "title": "Sales Associate",
	  "job-description": "To sell stuff",
	  "photo": "https://www.cubetree.com/images/your-profile-pic.png",
	  "email-addresses": [
	    {
	      "location": "Corporate",
	      "address": "john.doe@corporate.com"
	    },
	    {
	      "location": "Home",
	      "address": "jdoe@myhome.com"
	    },
	    ...
	  ],
	  "phone-numbers": [
	    {
	      "location": "Office",
	      "number": "1-800-999-9999"
	    },
	    {
	      "location": "Mobile",
	      "number": "1-800-555-1212"
	
	    },
	    ...
	  ],
	  "im-accounts": [
	    {
	      "service": "AIM",
	      "handle": "salesdood",
	    },
	    ...
	  ],
	  "office-location": "4 Penn Plaza, New York, NY",
	  "twitter-username": "salesdood",
	  "current-status": "Selling things"
	}
	
Groups Request
	[
	  {
	    "id": 1,
	    "name": "Future Ideas",
	    "description": "Ideas for the future",
	    "acl": "public",
	    "scope": "internal"
	  },
	  {
	    "id": 2,
	    "name": "All Things Bacon",
	    "description": "Bacon, bacon, bacon",
	    "acl": "private",
	    "scope": "xco"
	  },
	  ...
	]
	

Retrieving Group Information

Resources

Method URL Description
GET
https://www.cubetree.com/api/v1/groups
Retrieve a groups's information
GET
https://www.cubetree.com/api/v1/groups/followers
Retrieve the list of a group's followers

Parameters

id=id

The group ID for which you are requesting information.

Responses

List Request
Group Information
	{
	  "id": 12345,
	  "name": "Future Plans",
	  "description": "Discussions of stuff we'd like to do at some point",
	  "photo": "https://www.cubetree.com/images/group-profile-pic.png",
	  "acl": "public",
	  "scope": "internal",
	  "created-at": 1234567890,
	  "creator-id": 12345,
	  "stats": {
	  "docs": 0,
	  "links": 4,
	  "photos": 1,
	  "followers": 10
	  }
	}
	
Followers Request
	[
	  {
	    "id": 1,
	    "first-name": "Joe",
	    "last-name": "Smith",
	    "title": "Janitor",
	    "photo": "https://www.cubetree.com/images/your-profile-pic.png",
	  },
	  {
	    "id": 2,
	    "first-name": "Frank",
	    "last-name": "Schlobatnik",
	    "title": "Baseball Player",
	    "photo": "https://www.cubetree.com/images/your-profile-pic.png"
	  },
	  ...
	]
	

Working with Tasks

Resources

Method URL Description
GET
https://www.cubetree.com/api/v1/action_item
List the given member's tasks (accepts only feed_id parameter; if omitted, will return logged-in member's tasks)
POST
https://www.cubetree.com/api/v1/action_item/item
Assign a new task from the currently logged-in member (accepts assignee_id and message parameters)
POST
https://www.cubetree.com/api/v1/action_item/complete
Mark a task as completed (accepts only id parameter)

Parameters

id=id

The task ID for which you are requesting information.

feed_id=id

The ID of the member on whose behalf you are requesting a list of tasks.

assignee_id=id

The ID of the member to whom you are assigning a newly-created task.

message=string

The message associated with a newly-created task.

Responses

List Tasks
	[
		{
			"due-date": 1258088399,
			"creator-name": "Joe Brown",
			"created-at": 1257181677, 
			"assignee-name": "Frank Smith",
			"assignee-id": 201, 
			"action": "Update last quarter's sales figures.",
			"assigner-id": 112,
			"id": 4001,
			"creator-id": 112,
			"source": null,
			"assigner-name": "Joe Brown"
		}
		...
	]
	
Create Task

Returns the same as for an individual task from the List Tasks request.

Mark Task Completed

No body response; use HTTP response code to determine success or failure.