Upload and download
Create buckets, put and get files, list them, and rename, copy or delete them.
Buckets
curl -X POST https://api.teepin.com/v1/storage/buckets \
-H "Authorization: Bearer $TEEPIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "my-bucket"}'
curl https://api.teepin.com/v1/storage/buckets \
-H "Authorization: Bearer $TEEPIN_API_KEY"Put and get
curl -X PUT "https://api.teepin.com/v1/storage/buckets/my-bucket/object?key=notes/hello.txt" \
-H "Authorization: Bearer $TEEPIN_API_KEY" \
-H "Content-Type: text/plain" \
--data-binary @hello.txt
curl "https://api.teepin.com/v1/storage/buckets/my-bucket/object/content?key=notes/hello.txt" \
-H "Authorization: Bearer $TEEPIN_API_KEY" -o hello.txtDownloads support HTTP Range requests, so you can read part of a file or resume a download.
List
Listings come a page at a time. Pass delimiter=/ to see folders as prefixes, and the next_cursor of one page as cursor to get the next.
curl "https://api.teepin.com/v1/storage/buckets/my-bucket/objects?prefix=photos/&delimiter=/" \
-H "Authorization: Bearer $TEEPIN_API_KEY"Rename, copy and delete
Renaming only changes the catalog, so it is instant at any size. Copy duplicates the bytes.
s.rename_object("my-bucket", "draft.txt", "final.txt")
s.copy_object("backup", "final.txt", "my-bucket", "final.txt") # to backup/final.txt
s.delete_object("my-bucket", "old.txt")
s.delete_objects("my-bucket", ["a.txt", "b.txt"]) # up to 1,000 a requestETags
An object's ETag is the SHA-256 of its bytes. For an object uploaded in parts it is the SHA-256 of the parts' SHA-256s, followed by - and the number of parts. Use it to check that a local file matches what is stored.