
Setting up and integrating GRIDBLAZE into your application is a snap. Use our HTTP POST ingest system or an Openstack Swift compatible PUT Object API to store content. To read or access the content simply call the URL provided or call the API’s GET command.
Below you’ll find tutorials that will guide you through a simple use case of how to use GRIDBLAZE, and reference documentation for all the moving parts.
Storing a file to GRIDBLAZE
HTTP POST
Simple steps:
- Setup your application to be able to POST via HTTP (form or otherwise)
- Signup for GRIDBLAZE and obtain an APP ID and SECRET KEY (By creating a new application in the application manager). You will need these 2 to be able to communicate with our system
- When you generate your upload request form, specify our server “upload.gridblaze.com” as the POST location. Your files will automatically be routed to the closest GRIDBLAZE storage server for processing
- Depending on your scripting language, you will need to generate a “Signature” to be put as a hidden field in your FORM
- Create a Return URL (return_url). This would be a script page that is publicly accessible that would be called by our storage server after a successful upload to display to your user.
- Create an optional Authentication URL (auth_url) on your web server. This URL is specified in the application manager and if provided will be called by our ingest servers after you upload a file to “approve” an upload. You can put in code here to check that you would like to store the file based on the type or size etc.
- That’s it, format everything into a web form and HTTP POST the file over to us and we will send you the URL of the file accessible using our high speed CDN to be used as you please.
Details
Create a form to send the file to GRIDBLAZE
Method: “POST”
Action: http://upload.gridblaze.com
Enctype: multipart/form-data
Compulsory
| Input Fields | Details |
|---|---|
| Appid | This should be the Appid that the system generated for you in the application manager.Eg. <input type=”hidden” name=”appid” value=”453acbc”> |
| Signature | The signature is a sha256 hash of the required fields in this exact order: appid > appkey > return_url > directory* > datetime > options* > meta* Eg. in php – $authsig = hash(‘sha256′, $appid.$key.$return_url.$directory.$datetime.$options.$meta); Eg on form – <input type=”hidden” name=”signature” value=”authsig”> *optional |
| return_url | The URL of the return script that Gridblaze will POST to after completing the upload.Eg. <input type=”hidden” name=”return_url” value=”http://www.mysite.com/script.php”>Alternatively you can pass the keyword “JSON” in the return_url and we will return a JSON formatted reply after uploading. |
| datetime (in epoch format) | The unix epoch formatted datetime when the page is generated as encoded in the signature.Eg. <input type=”hidden” name=”datetime” value=”13332112236″> |
| input type | The form must be told to post to a type known is “file”. Note the maximum size you will allow to be posted.Eg. <input type=”file” name=”file” size=”10000000″> |
Optional
| Input Fields | Details |
|---|---|
| Directory | The sub directory that we will upload to or create. Eg, “/mydir/mysebdir” or “/” to store into the root. If this is not specified, files will be stored into the root. |
| option |
|
| enable_auth | If you would like to do a 2nd level approval of file uploads on your server before allowing a file to be saved on GRIDBLAZE, key in the URL in the app manager. And set this to “yes” else it will default to “no” if it is not provided. The URL entered for this attribute should be the full URL including http:// and should read in the file name, file size and source IP and reply with a success or fail reply. |
| Meta Data | The meta data as associated with the object that you would like to store. This meta data can be searchable in the future and used to track your object. This is to be sent in a JSON formatted style and URLENCODE for the hidden field. |
| Custom Fields | Other POST form data can be sent to GRIDBLAZE (both hidden and user input) and we will pass them along to your return_url page as-is. |
Sample PHP
[cc lang="php"]
//Sample Script in PHP for the generation of a form to upload files/objects into Gridblaze storage
$appid = ‘APPID’; //AppID
$secret_key = ‘YOURSECRETKEY’;
$return_url = ‘http://return.url.com/return.php’;
$directory = ‘/’; //The directory to place the file. Eg,/mydirectory/
$meta = “{\”name\”: \”myfile\”,\”type\”: \”just a file\”}”; //Meta text data associated with the file json encoded key:value
$option = ‘default’;
$enable_auth = ‘no’;
//Option include autogen, replace, reject, default.
$upload_url = “http://upload.gridblaze.com”; //Fixed, do not change
$datetime = time();//Epoch time format at the generation of the signature;
$signature = hash(‘sha256′,$appid.$secret_key.$return_url.$directory.$datetime.$option.$enable_auth.$meta);
?>
[/cc]
Sample Ruby
[cc lang="ruby"]
# Sample Ruby app (using Sinatra) for the generation of a form
# to upload files/objects into Gridblaze storage
require ‘sinatra’
get ‘/’ do
erb :main, :locals => {
:appid => ‘YOUR_APP_ID’,
:secret_key => ‘YOUR_SECRET_KEY’,
:return_url => ‘http://some.url.com/return’, #A valid URL that the system will POST to after uploading successfully
:directory => ‘/’, # The directory to place the file. Eg,/mydirectory/
:meta => ”, # Meta text data associated with the file json encoded key:value
ption => ‘default’, # Option include autogen, replace, reject, default.
:enable_auth => ‘no’, # Do you want to enable the authentication URL to have the upload approved by your own server?
:upload_url => “http://upload.gridblaze.com”, # Fixed, do not change
:datetime => Time.now.to_i.to_s, # Epoch time format at the generation of the signature
}
end
post ‘/upload-finished’ do
erb :upload_finished, :locals => {
:url => “http://#{params[:location]}”
}
end
__END__
@@ main
@@ upload_finished
Success! Your file is at
Visit our developer resource here
Reading a file from GRIDBLAZE storage
HTTP Get
Content Access/Delivery using our realtime high speed CDN
- Use the URL provided when we return the “location” in a post header to the return_url
- Or check the URL from the object manager
- Or you can retrieve the list of objects using our API list command
The format of the URL will be similar to http://g.csn.io/us1/884773/this_is_the_file.jpg
API Get
Visit our developer resource here
Exploring/Listing your objects stored on GRIDBLAZE
You’ll probably also be interested in downloading one of our API libraries, or seeing some example projects. Get more details from our developer site.
SEarch
News Blog
We’ve been acquiredFebruary 20, 2013
CNAME Access Immediate AvailabilityNovember 28, 2012
SSL Delivery and HTTPs is hereNovember 21, 2012
Jumpstart Your IT Infrastructure with the CloudOctober 16, 2012

Connect