diff --git a/rest/rest-tests.ts b/rest/rest-tests.ts
new file mode 100644
index 0000000000..4ffe17d21d
--- /dev/null
+++ b/rest/rest-tests.ts
@@ -0,0 +1,40 @@
+///
+
+import rest = require('rest');
+import mime = require('rest/interceptor/mime');
+import errorCode = require('rest/interceptor/errorCode');
+import registry = require('rest/mime/registry');
+
+rest('/').then(function(response) {
+ console.log('response: ', response);
+});
+
+
+var client = rest.wrap(mime);
+client({ path: '/data.json' }).then(function(response) {
+ console.log('response: ', response);
+});
+
+client = rest.wrap(mime).wrap(errorCode, { code: 500 });
+client({ path: '/data.json' }).then(
+ function(response) {
+ console.log('response: ', response);
+ },
+ function(response) {
+ console.error('response error: ', response);
+ }
+);
+
+registry.register('application/vnd.com.example', {
+ read: function(str: string) {
+ var obj: any;
+ // do string to object conversions
+ return obj;
+ },
+ write: function(obj: any) {
+ var str: string;
+ // do object to string conversions
+ return str;
+ }
+});
+
diff --git a/rest/rest.d.ts b/rest/rest.d.ts
new file mode 100644
index 0000000000..34ffc3bf21
--- /dev/null
+++ b/rest/rest.d.ts
@@ -0,0 +1,92 @@
+// Type definitions for rest.js v1.2.0
+// Project: https://github.com/cujojs/rest
+// Definitions by: Wim Looman
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module "rest" {
+ import when = require("when");
+
+ export = rest;
+
+ function rest(path: string): rest.ResponsePromise;
+ function rest(request: rest.Request): rest.ResponsePromise;
+
+ module rest {
+ export function wrap(interceptor: Interceptor): Client;
+
+ export interface Request {
+ method?: string;
+ path?: string;
+ params?: any;
+ headers?: any;
+ entity?: any;
+ }
+
+ export interface Status {
+ code: number;
+ text?: string;
+ }
+
+ export interface Headers {
+ [index: string]: any // string or string[]
+ }
+
+ export interface Response {
+ request: Request;
+ raw: any;
+ status: Status;
+ headers: Headers;
+ entity: any;
+ }
+
+ export interface ResponsePromise extends when.Promise {
+ entity(): when.Promise;
+ status(): when.Promise;
+ headers(): when.Promise;
+ header(headerName: string): when.Promise; // string or string[]
+ }
+
+ export interface Interceptor {
+ (parent?: Client, config?: any): Client;
+ }
+
+ export interface Client {
+ (path: string): ResponsePromise;
+ (request: Request): ResponsePromise;
+
+ skip(): Client;
+ wrap(interceptor: Interceptor, config?: any): Client;
+ }
+ }
+}
+
+declare module "rest/interceptor/errorCode" {
+ import rest = require("rest");
+
+ var errorCode: rest.Interceptor;
+
+ export = errorCode;
+}
+
+declare module "rest/interceptor/mime" {
+ import rest = require("rest");
+
+ var mime: rest.Interceptor;
+
+ export = mime;
+}
+
+declare module "rest/mime/registry" {
+ import when = require("when");
+
+ export interface MIMEConverter {
+ read(value: string): any; // any or when.Promise;
+ write(value: any): any; // string or when.Promise;
+ }
+
+ export function lookup(mimeType: string): when.Promise;
+
+ export function register(mimeType: string, converter: MIMEConverter): void;
+}