The TypeFront Application Programming Interface is simply another way to manage your fonts - one that makes it easy for third-party and custom tools to programatically access and interact with the service. The API follows the REST style, and this guide should provide everything you need to implement software that works with TypeFront.
You can use any tool such as cURL to interact with the TypeFront API, and libraries are available for the following programming languages (watch this space for more to come):
TypeFront uses a combination of HTTP Basic Authentication and SSL to ensure that only authorised users can interact with your account, and to ensure that your password is safe from eavesdropping.
If you’ve used the TypeFront web site, the URIs in the TypeFront API will look familiar. That’s because both views of the application use the same URIs. In the REST model, URIs are considered identifiers for resources, and each resource can have several representations - such as the standard HTML view and a JSON version. Here are the JSON versions of the URIs available in the API:
URI: https://typefront.com/fonts.json
Method: GET
Example cURL command:
curl --user john@somebody.com:password https://typefront.com/fonts.json
Example response:
[{"font":
{"font_family": "Droid Sans",
"font_subfamily": "Regular",
"id": 101}},
{"font":
{"font_family": "Droid Serif",
"font_subfamily": "Bold",
"id": 102}},
{"font":
{"font_family": "Graublau Web",
"font_subfamily": "Regular",
"id": 103}}]
URI: https://typefront.com/fonts/[id].json
Method: GET
Required parameters: id
Example cURL command:
curl --user john@somebody.com:password https://typefront.com/fonts/101.json
Example response:
{"font":
{"id": 101,
"font_family": "Droid Sans",
"font_subfamily": "Regular",
"copyright": "Digitized data copyright 2007, Google Corporation.",
"manufacturer": "Ascender Corporation",
"trademark": "Droid is a trademark of Google and may be registered in certain jurisdictions.",
"license": "Licensed under the Apache License, Version 2.0",
"license_url": "http://www.apache.org/licenses/LICENSE-2.0",
"description": "Droid Sans is a humanist sans serif typeface designed for user interfaces and electronic communication.",
"version": "Version 1.00",
"vendor_url": "http://www.ascendercorp.com/",
"designer_url": "http://www.ascendercorp.com/typedesigners.html",
"example_include_code": "@font-face {\n font-family: \"Droid Sans\";\n src: url(http://typefront.com/fonts/41.eot);\n font-weight: normal;\n font-style: normal;\n}\n\n@font-face {\n font-family: \"Droid Sans\";\n src: url(http://typefront.com/fonts/41.woff) format(\"woff\"),\n url(http://typefront.com/fonts/41.otf) format(\"opentype\");\n font-weight: normal;\n font-style: normal;\n}",
"compatible_full": "Droid Sans",
"allowed_domains":
[{"domain": "http://www.crazypartyhats.com", "id": 201},
{"domain": "http://johnsmith.com", "id": 202}]
"access_urls":
[{"format": "Extended OpenType", "url": "http://typefront.com/fonts/41.eot"},
{"format": "OpenType", "url": "http://typefront.com/fonts/41.otf"},
{"format": "TrueType", "url": "http://typefront.com/fonts/41.ttf"},
{"format": "Scalable Vector Graphics", "url": "http://typefront.com/fonts/41.svg"},
{"format": "Web Open Font Format", "url": "http://typefront.com/fonts/41.woff"}]}}
URI: https://typefront.com/fonts.json
Method: POST
Required parameters: font[original]
Example cURL command:
curl --user john@somebody.com:password --form font[original]=@font.ttf http://typefront.local:3000/fonts.json
Example response:
{"notice": "Successfully created font.",
"font":
{"id": 101,
"font_family": "Droid Sans",
"font_subfamily": "Regular",
"copyright": "Digitized data copyright 2007, Google Corporation.",
"manufacturer": "Ascender Corporation",
"trademark": "Droid is a trademark of Google and may be registered in certain jurisdictions.",
"license": "Licensed under the Apache License, Version 2.0",
"license_url": "http://www.apache.org/licenses/LICENSE-2.0",
"description": "Droid Sans is a humanist sans serif typeface designed for user interfaces and electronic communication.",
"version": "Version 1.00",
"vendor_url": "http://www.ascendercorp.com/",
"designer_url": "http://www.ascendercorp.com/typedesigners.html",
"example_include_code": "@font-face {\n font-family: \"Droid Sans\";\n src: url(http://typefront.com/fonts/41.eot);\n font-weight: normal;\n font-style: normal;\n}\n\n@font-face {\n font-family: \"Droid Sans\";\n src: url(http://typefront.com/fonts/41.woff) format(\"woff\"),\n url(http://typefront.com/fonts/41.otf) format(\"opentype\");\n font-weight: normal;\n font-style: normal;\n}",
"compatible_full": "Droid Sans",
"allowed_domains":
[{"domain": "http://www.crazypartyhats.com", "id": 201},
{"domain": "http://johnsmith.com", "id": 202}]
"access_urls":
[{"format": "Extended OpenType", "url": "http://typefront.com/fonts/41.eot"},
{"format": "OpenType", "url": "http://typefront.com/fonts/41.otf"},
{"format": "TrueType", "url": "http://typefront.com/fonts/41.ttf"},
{"format": "Scalable Vector Graphics", "url": "http://typefront.com/fonts/41.svg"},
{"format": "Web Open Font Format", "url": "http://typefront.com/fonts/41.woff"}]}}
URI: https://typefront.com/fonts/[id].json
Method: DELETE
Required parameters: id
Example cURL command:
curl --user john@somebody.com:password --request DELETE https://typefront.com/fonts/103.json
Example response:
{"notice": "Successfully removed font."}
URI: https://typefront.com/fonts/[id]/domains.json
Method: POST
Required parameters: id, domain[domain]
Example cURL command:
curl --user john@somebody.com:password --data "domain[domain]=http://www.fingerpuppetz.com" https://typefront.com/fonts/102/domains.json
Example response:
{"notice": "Successfully added allowed domain to font.",
"domain":
{"font_id": 102,
"domain": "http://www.fingerpuppetz.com",
"id": 203}}
URI: https://typefront.com/fonts/[id]/domains/[domain_id].json
Method: DELETE
Required parameters: id, domain_id
Example cURL command:
curl --user john@somebody.com:password --request DELETE https://typefront.com/fonts/101/domains/201.json
Example response:
{"notice": "Successfully removed domain from allowed list."}