Getting started
This page goes to show how to connect, create your first share, and upload a file. The examples are with curl, but you should be able to understand the data sent and use it with another program.1. Authenticate
First, you need to authenticate. The first time, use email/password. Any other time you need to log in, use the refreshtoken.
curl -X POST --data '{"apikey":"...","email":"your@em.ail","password":"..."}' https://api.ge.tt/1/users/login
Server will return some JSON of your users' state. You can see how much storage space you have and how much you've used. Most importantly it returns an accesstoken and a refreshtoken. Use the refreshtoken next time this user needs to log in (don't store the users' password in your app). The accesstoken is used to all other calls to the server.{
"accesstoken":"a.0101.123123123123",
"refreshtoken":"r.0101.acbcabacbacbacb",
...
}
"accesstoken":"a.0101.123123123123",
"refreshtoken":"r.0101.acbcabacbacbacb",
...
}
2. Create your first share.
curl -X POST https://api.ge.tt/1/shares/create?accesstoken=a.0101.123123123123
The share will be returned. Most importantly you use the sharename.{
"sharename":"a1b2c3"
...
}
"sharename":"a1b2c3"
...
}
3. Create file
Now it's time to upload your first file. The way this works is that you first create your file, and then upload it afterwards.
To test it out use a small file. You can use echo "hello world" > myfile.txt to create a test file.
To test it out use a small file. You can use echo "hello world" > myfile.txt to create a test file.
curl -X POST --data '{"filename":"myfile.txt"}' https://api.ge.tt/1/files/a1b2c3/create?accesstoken=a.0101.123123123123
The server returns various things. The readystate is remote which means that the server now knows that the file exists, but you need to upload it. Then a URL for where the file can be seen by others - this is the link you should post to others. Most importantly it contains two URL's where should upload the file to. There are two URL's because you can either use PUT or POST.{
"readystate":"remote",
"getturl":"http://ge.tt/a1b2c3/v/0",
"upload":{
"puturl":"http://blobs.ge.tt/a1b2c3/myfile.txt?sig=-TR2k2-3kjsh9nfmn4",
"posturl":"http://blobs.ge.tt/a1b2c3/?filename=myfile.txt&sig=-TR2k2-3kjsdfkjhf3ksf"
}
...
}
"readystate":"remote",
"getturl":"http://ge.tt/a1b2c3/v/0",
"upload":{
"puturl":"http://blobs.ge.tt/a1b2c3/myfile.txt?sig=-TR2k2-3kjsh9nfmn4",
"posturl":"http://blobs.ge.tt/a1b2c3/?filename=myfile.txt&sig=-TR2k2-3kjsdfkjhf3ksf"
}
...
}
4. Upload file
Finally, upload the file. In this example we use the puturl.
curl --upload-file myfile.txt http://blobs.ge.tt/a1b2c3/myfile.txt?sig=-TR2k2-3kjsh9nfmn4
Now, to see that it works, open http://ge.tt/a1b2v3/v/0 in your browser.To continue, read the REST API and see what else you can do. For the advanced users, you can read up on the Live API which is used to utilize the advanced queing functions of Ge.tt.