REST API

The API is hosted at open.ge.tt and all calls to the API are JSON except for the actual file upload. All communication to the API is done over https except for actual file upload and download.

For the purpose of these docs we use the apikey testapi.

Authentication

Most of the API calls requires an accesstoken which you gain from authenticating with the api

POST /1/users/login

The API is based on oauth with an xauth handshake. The request body looks like this:

{
    "apikey":"apitest", // use your own API key here
    "email":"apitest@ge.tt", // the users email
    "password":"secret" // the users password
}

// or using the refreshtoken

{
    "refreshtoken":"r.test-app.u2DjvJQrKsvGGa9rw0..."
}

With curl: curl -X POST --data '{...}' https://open.ge.tt/1/users/login

The response looks like this:

{
    "accesstoken": "a.test-app.u2DjvJQrKsvGGa9rw0h...",
    "refreshtoken": "r.test-app.u2DjvJQrKsvGGa9rw0...",
    "expires": 86400,
    "user": {
        "userid": "u2DjvJQrKsvGGa9rw0hGXmcUPj3Bpajebi4dK-9U",
        "fullname": "Mr API Test",
        "email": "apitest@ge.tt",
        "files": 42,
        "downloads": 562,
        "storage": {
            "used": 2424444, // used storage in bytes
            "limit": 20000000000, // current storage limit
            "extra": 0 // any extra storage you have been give. This is ALREADY INCLUDED in limit
        }
    }
}

GET /1/users/me?accesstoken={at}

Returns your user information:

{
    "userid": "u2DjvJQrKsvGGa9rw0hGXmcUPj3Bpajebi4dK-9U",
    "fullname":"Mr API Test",
    "email": "apitest@ge.tt",
    "files": 42,
    "downloads": 562,
    "storage": {
        "used": 24242444,
        "limit": 2000000000,
        "extra": 0

    }   
}

With curl: curl https://open.ge.tt/1/users/me?accesstoken={at}

Shares

Shares are the containers of files and can contain meta data such as a title

GET /1/shares?accesstoken={at}

Returns all your shares and the containing files:

[
    {
        "sharename":"4dsfd",
        "title": "my title",
        "created": 1321971209, // created date in unix time         
        "files":[{...}]
    },
    {
        ...
    }
]

You can limit how many shares are returned of from which offset by providing a skip and a limit querystring parameter

With curl: curl https://open.ge.tt/1/shares?accesstoken={at}

POST /1/shares/create?accesstoken={at}

Creates a new share. The request body is optional but can look like:

{
    "title":"My files" // Optional title of the share
}

With curl: curl -X POST https://open.ge.tt/1/shares/create?accesstoken={at}

GET /1/shares/{sharename}

Lists a share.

{
    "sharename":"4ddfds",
    "title":"optional title",
    "created": 1321971209, // created date in unix time
    "files":[
        {
            "filename":"myfile.txt",
            "fileid":"0",
            "downloads":2,
            "readystate":"uploaded",
            "getturl":"http://ge.tt/4ddfds/v/0"
        }
    ]
}

With curl: curl https://open.ge.tt/1/shares/4ddfds

POST /1/shares/{sharename}/update?accesstoken={at}

Updates a share. Currently you can only update the title

{
    "title":"my new title" // or "title":null to delete it
}

The response is the same as with a GET call.

With curl: curl -X POST --data '{"title":"my new title"}' https://open.ge.tt/1/shares/{sharename}/update?accesstoken={at}

POST /1/shares/{sharename}/destroy?accesstoken={at}

Delete a share and all of its files.

With curl: curl -X POST https://open.ge.tt/1/shares/{sharename}/destroy?accesstoken={at}

Files

POST /1/files/{sharename}/create?accesstoken={at}

To upload files to Ge.tt you must first create the file under a given share. You do that by posting the filename:

{
    "filename":"myfile.txt",
    "session": "df32fsdfddf" // OPTIONAL! and only used by the live API
}

This returns the following data:

{
    "filename":"myfile.txt",
    "fileid":"0",
    "downloads":0,
    "sharename":"4ddfds",
    "readystate":"remote",
    "created": 1321971209, // created date in unix time
    "getturl":"http://ge.tt/4ddfds/v/0",
    "upload": {
        "puturl":"http://blobs.ge.tt/4ddfds/myfile.txt?sig=24ls0tjdsdfs...",
        "posturl":"http://blobs.ge.tt/4ddfds?filename=myfile.txt?sig=35640rghfdd..."
    }
}

Notice that the file has a readystate property which is set to remote. This means that the file won't be listed in the share unless you are using the live API. When you start uploading the file the readystate will become uploading and after it is uploaded it will become uploaded. Files with readystate uploading or uploaded will be listed in the share and will also be available for download. Files with readystate remote are available for download when using the live API.

If you are not using the live api you should start a PUT or POST of the file immediately using the urls in upload respectively.

Both PUT and POST currently require you to send the Content-Length header in your upload request. A PUT request's body just contains the file whereas the POST should be encoded as multipart/form-data (supported by forms in the browser).

With curl: curl --upload-file myfile.txt http://blobs.ge.tt/4ddfds/myfile.txt?sig=24ls0tjdsdfs...

If you are using the live API you should add them to an upload queue and start uploading them if you are not uploading anything else or if you get a download notification

GET /1/files/{sharename}/{fileid}

Get the state of a file. This returns the following data:

{
    "filename":"myfile.txt",
    "fileid":"0",
    "downloads":2,
    "sharename":"4ddfds",
    "readystate":"uploaded"
    "created": 1321971209, // created date in unix time         
    "getturl":"http://ge.tt/4ddfds/v/0"
}

With curl: curl https://open.ge.tt/1/files/{sharename}/{fileid}

GET /1/files/{sharename}/{fileid}/upload?accesstoken={at}

Get upload urls to the file. This returns a new PUT and POST url for you to upload the file to. OBS You can also choose to use the put- or posturl that you were previously given to override the file.

The response looks like:

{
    "puturl":"http://blobs.ge.tt/4ddfds/myfile.txt?sig=24ls0tjdsdfs...",
    "posturl":"http://blobs.ge.tt/4ddfds?filename=myfile.txt?sig=35640rghfdd..."
}

With curl: curl https://open.ge.tt/1/files/{sharename}/{fileid}/upload

POST /1/files/{sharename}/{fileid}/destroy?accesstoken={at}

Delete a file and the binary contents.

With curl: curl -X POST https://open.ge.tt/1/files/{sharename}{fileid}/destroy?accesstoken={at}

GET /1/files/{sharename}/{fileid}/blob

Will redirect to the binary content of the file

With curl: curl -L https://open.ge.tt/1/files/{sharename}/{fileid}/blob

GET /1/files/{sharename}/{fileid}/blob/thumb

Will redirect to a thumbnail of the binary file. Currently only available for images.

With curl: curl -L https://open.ge.tt/1/files/{sharename}/{fileid}/blob/thumb