API & Embed

API General Overview

The Gzaas API is implemented over standard HTTP requests (REST).
This allows Gzaas to be integrated with just about any application that can connect to the web.


Contents

(GET) /api/fonts: Reading fonts from gzaas as JSON
(GET) /api/patterns: Reading bakground patterns from gzaas JSON
(GET) /api/styles: Reading styles from gzaas as JSON
(POST) /api/write: Creating a gzaas (API Key needed)

You can get detailed information about the different functionalities by clicking on them on the left menu.

You can also use the GzaasAPI PHP Client made by Gonzalo Ayuso (@gonzalo123)

API Key

You need an API Key in order to use the Gzaas API WRITE functionality. Get it now!
You can optionally tell us the web from where you’re going to use it, and a way of contacting you.

Website (*Optional):  
Contact (*Optional):


API Key succesfully generated!

/api/fonts

This API GET method returns the fonts used in gzaas.com in JSON format.

The method is called like this:
http://gzaas.com/api/v1/fonts
(See that the version of the API is included in the HTTP request)

Optional Parameters

numResults number of fonts returned
nowFeatured featured fonts?
0: not neccesary
1: yes, featured fonts

 

Example

http://gzaas.com/api/v1/fonts?numResults=2&nowFeatured=0

{
    "0": {
          "id": "59",
          "hashtag": "3dumb",
          "description": "3Dumb",
          "fontFace": "1",
          "stylesheet": "/css/fonts/3Dumb/stylesheet.css",
          "fontFamily": "'3DumbRegular'",
          "fontServer": "1",
          "designer": "Tension Type",
          "urlDesigner1": "http://www.fontsquirrel.com/foundry/Tension-Type",
          "urlDesigner2": null,
          "nowFeatured": "0"
    },
    "1": {
          "id": "29",
          "hashtag": "allan",
          "description": "Allan",
          "fontFace": "1",
          "stylesheet": "http://fonts.googleapis.com/css?family=Allan:bold",
          "fontFamily": "'Allan'",
          "fontServer": "2",
          "designer": "Anton Koovit",
          "urlDesigner1": "http://code.google.com/webfonts/designer?designer=Anton+Koovit",
          "urlDesigner2": "http://anton.korkork.com/",
          "nowFeatured": "1"
    }
}

 

Breakdown of API JSON:

id Unique id for this font
hashtag Hashtag that identifies the font
description Complete Name of the font
fontFace FontFace?
0: client side font (arial, times, georgia…)
1: font-face (Museo, Chewy…)
stylesheet <head> stylesheet from where to get the font
fontFamily css font-family name used to render the font
fontServer Server that serves the font:
0: none (client side font)
1: gzaas
2: google webfonts
designer Name of the font designer
urlDesigner1 Link back to designers portfolio (on FontSquirrel / Google Webfonts)
urlDesigner2 Link back to designers portfolio (own)
nowFeatured Is it featured in the editor at gzaas.com?
0: no
1: yes

/api/patterns

This API GET method returns the patterns used in gzaas.com (JSON).
(Similar to the /api/fonts method)

The method is called like this:
http://gzaas.com/api/v1/patterns
(See that the version of the API is included in the HTTP request)

Optional Parameters

numResults number of patterns returned
nowFeatured featured patterns?
0: not neccesary
1: yes, featured patterns

 

Example

http://gzaas.com/api/v1/patterns?numResults=2&nowFeatured=0

{
    "0": {
          "id": "10",
          "hashtag": "backbirthday",
          "description": "Birthday",
          "url": "http://gzaas.com/images/patterns/BackgroundLabs/birthday.jpg",
          "server": "BackgroundLabs",
          "designer": "BackgroundLabs",
          "urlDesigner1": "http://backgroundlabs.com",
          "urlDesigner2": null,
          "nowFeatured": "0"
    },
    "1": {
          "id": "2",
          "hashtag": "backblackboard",
          "description": "Blackboard",
          "url": "http://gzaas.com/images/patterns/BackgroundLabs/blackboard.jpg",
          "server": "BackgroundLabs",
          "designer": "BackgroundLabs",
          "urlDesigner1": "http://backgroundlabs.com",
          "urlDesigner2": null,
          "nowFeatured": "0"
    }
}

 

Breakdown of API JSON:

id Unique id for this pattern
hashtag Hashtag that identifies the pattern
description Complete Name of the pattern
url Url of the pattern image
server Name of the pattern server
designer Name of the pattern designer
urlDesigner1 Link back to designers portfolio (on BackgroundLabs / ColourLovers…)
urlDesigner2 Link back to designers portfolio (own)
nowFeatured Is it featured in the editor at gzaas.com?
0: no
1: yes

/api/styles

This API GET method returns the styles used in gzaas.com in JSON format.

The method is called like this:
http://gzaas.com/api/v1/styles
(See that the version of the API is included in the HTTP request)

Optional Parameters

numResults number of styles returned
nowFeatured featured styles?
0: not neccesary
1: yes, featured styles

 

Example

http://gzaas.com/api/v1/styles?numResults=2&nowFeatured=1

{
    "0": {
          "id": "4",
          "hashtag": "s_chewy1",
          "description": "Chewy love",
          "font": {
              "id": "37",
              "hashtag": "chewy",
              "description": "Chewy",
              "fontFace": "1",
              "stylesheet": "http://fonts.googleapis.com/css?family=Chewy:regular",
              "fontFamily": "'Chewy'",
              "fontServer": "2",
              "designer": "Sideshow",
              "urlDesigner1":

"http://code.google.com/webfonts/designer?designer=Sideshow",
              "urlDesigner2": "http://squidart.com/",
              "nowFeatured": "1"
          },
          "pattern": {
              "id": null,
              "hashtag": null,
              "description": null,
              "url": null,
              "server": null,
              "designer": null,
              "urlDesigner1": null,
              "urlDesigner2": null,
              "nowFeatured": null
          },
          "color": "ffffff",
          "backcolor": "FE28A2",
          "shadow": null,
          "designer": "ojoven",
          "urlDesigner": "http://twitter.com/ojoven",
          "nowFeatured": "1"
    },
    "1": {
          "id": "1",
          "hashtag": "s_chunky1",
          "description": "Chunky Yellow",
          "font": {
              "id": "9",
              "hashtag": "chunkfive",
              "description": "ChunkFive",
              "fontFace": "1",
              "stylesheet": "/css/fonts/ChunkFive/stylesheet.css",
              "fontFamily": "'ChunkFiveRegular'",
              "fontServer": "1",
              "designer": "The League of Moveable Type",
              "urlDesigner1":

"http://www.fontsquirrel.com/foundry/The-League-of-Moveable-Type",
              "urlDesigner2": "http://www.theleagueofmoveabletype.com",
              "nowFeatured": "0"
          },
          "pattern": {
              "id": null,
              "hashtag": null,
              "description": null,
              "url": null,
              "server": null,
              "designer": null,
              "urlDesigner1": null,
              "urlDesigner2": null,
              "nowFeatured": null
          },
          "color": "000000",
          "backcolor": "ffe303",
          "shadow": null,
          "designer": "ojoven",
          "urlDesigner": "http://twitter.com/ojoven",
          "nowFeatured": "1"
    }
}

 

Breakdown of API JSON:

id Unique id for this style
hashtag Hashtag that identifies the style
description Complete Name of the style
font Font used for the style. See /api/fonts for the font schema.
pattern Pattern used for the style. See /api/patterns for the pattern schema.
color Font color of the style (hexadecimal, no #)
backcolor Background color of the style (hexadecimal, no #)
shadow Shadows used for the style.
Css like shadow sintaxis.
designer Name of the style designer
urlDesigner Link back to the style designers portfolio
nowFeatured Is it featured in the editor?
0: no
1: yes

/api/write

This API GET method creates a gzaas and returns the url generated.

The method is called like this:
http://gzaas.com/api/v1/write?apikey=YOUR_API_KEY&message=hello
(See that the version of the API is included in the HTTP request)
 

Needed Parameters

apikey ApiKey of your application
message The gzaas! text message

 

Optional Parameters

font [string] Font desired (identified by its hashtag)
color [string] Font color (hexadecimal)
backcolor Background color (hexadecimal)
backpattern [string] Background pattern desired (identified by its hashtag)
shadows Shadows (css hex. sintaxis -> 1px 0 2px #ccc)
Multiple shadows admitted (max 5)
style [string] Style desired (identified by its hashtag)
visibility [0,1]
0: Private, not accessible in gzaas gallery (nor googles)
1: Public, accesible by everyone
launcher [string] Text of the launcher.

 

NOTES:
* In addition to the Needed Parameters, you must include at least ONE Styling parameter (font/color/backcolor/backpatter/style) to get a valid response.
* Backcolor & Backpattern are exclusive between them. If both are included (and both correct) backpattern will be used.
* Style and (font/color/backcolor/backpattern) are not exclusive. When a font (e.g) and a style go together in a gzaas creation, the style will explode and the gzaas will be generated using the font and the remaining features of the style (and it will not be associated with the style itself).

 

PHP Example

<?php
// Authorization info
$apikey    = 'YOUR_API_KEY';

// Data for new gzaas
$message  = 'hello megan!!!';
$font = 'chewy';
$color  = '444444';
$backcolor  = 'fcfcee';
$visibility  = 0;

// Prepare POST request
$request_data = http_build_query(
array(
'apikey'     => $apikey,
'message'  => $message,
'font'      => $font,
'color'     => $color,
'backcolor'      => $backcolor,
'visibility' => $visibility
)
);


// Send the POST request (with cURL)
$c = curl_init('http://gzaas.com/api/v1/write');
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $request_data);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($c);
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);

// Check for success
if ($status == 201) {
echo "Success! Your gzaas was succesfully created. UrlKey = $result['urlKey'].\n";
} else if ($status == 403) {
echo 'API Key error';
} else {
echo "Error: $result\n";
}
?>

Embedding gzaases

You can embed the gzaases in any website by using the following code:

<iframe src="http://gzaas.com/embedded/HERE_GOES_THE_GZAAS_URL_KEY" width="DESIRED_WIDTH" height="DESIRED_HEIGHT" scrolling="no" frameborder="0">
</iframe>

For example, for the gzaas http://gzaas.com/Kb9H, with the URL_KEY: Kb9H, we’ll embed it like this:

<iframe src=”http://gzaas.com/embedded/Kb9H” width=”480px” height=”260px” scrolling=”no” frameborder=”0″>
</iframe>

So you can play with the size of the iframe to adjust it to the desired size of your gzaas: