Home

Show Me How!

 

 

Console (curl)

curl 'http://api.blitline.com/job' -d json='{ "application_id": "YOUR_APP_ID", "src" : "http://www.google.com/logos/2011/yokoyama11-hp.jpg", "v" : 1.20, "functions" : [ {"name": "blur", "params" : {"radius" : 0.0,  "sigma" : 2.0}, "save" : { "image_identifier" : "MY_CLIENT_ID" }} ]}'

Ruby

require 'net/http'
require 'json'

job_data = {
            "application_id" => "YOUR_APP_ID",
            "src" => "http://www.google.com/logos/2011/yokoyama11-hp.jpg",
            "functions" => [
            {
                "name" => "blur",
                "save" => { "image_identifier" => "MY_CLIENT_ID" }
            }]
        };

http = Net::HTTP.new("api.blitline.com", 80)
request = Net::HTTP::Post.new("http://api.blitline.com/job")
request.set_form_data({"json" => JSON.dump(job_data)})
http.request(request) do |response|
    if response.is_a?(Net::HTTPSuccess)
        output = response.read_body
    else
        output = "Error #{response.read_body}"
    end
    puts output
end

NodeJS

var job_data = {
            "application_id" : "YOUR_APP_ID",
            "src" : "http://www.google.com/logos/2011/yokoyama11-hp.jpg",
            "functions" : [
            {
                "name": "blur",
                "save" : { "image_identifier" : "MY_CLIENT_ID" }
            }]
        };

sendHttpPostToBlitline(job_data);


// Function to send data to Blitline
function sendHttpPostToBlitline(job_data) {
    var http = require('http');

    var options = {
        host: 'api.blitline.com',
        port: 80,
        method:"POST",
        path: '/job'
    };

    var req = http.request(options, function(res) {
            res.on("data", function(chunk) {
            console.log("Data=" + chunk);
        });
    }).on('error', function(e) {
        console.log("Got error: " + e.message);
    });

    req.write("json="+ JSON.stringify(job_data));
    req.end();
}

 

These will return json that looks like:

{
    "results":
    {
        "images":[{
                     "image_identifier": "MY_CLIENT_ID",
                     "s3_url": "https://s3.amazonaws.com/dev.blitline/2011111513/1/fDIFJQVNlO6IeDZwXlruYg.jpg"
                 }],
        "job_id": "4ec2e057c29aba53a5000001"
    }
}
Or...
{
    "results":
    {
        "error": "Some error message, lorem ipsum"
    }
}

 

Now what?

Read the API page for a more in-depth description of the api and job descriptions. Most jobs take very little time to process. You can probably go check the "s3_url" returned and see the processed image. But in a production environment you are going to have to either register a callback to your server (know on Blitline as a "postback") or do some long polling.

 


Development Libraries

Ruby: Blitline Gem

Node: Blitline via NPM

Java: Blitline via Java

Javascript: Blitline via Browser Javascript

.NET: Blitline.NET  (Community Maintained)