TypeSquare

Language of the service which you are trying to access differs from your region.
You can register TypeSquare in Japan, United States, Taiwan and Korea.

Please choose the language that you want to use.
Notice that the service contents are different for each region.


This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com.

TypeSquare API Reference

*The use policy of this API is the same as that of TypeSquare.

1. TypeSquare Web API

Overview

The TypeSquare Web API issues keys using the distribution ID. This key can be used to manage registered URLs, acquire page views and lists of available fonts, and perform other operations.

Authentication

Function
Issue a TypeSquare Web API key
URL
https://typesquare.com/en/api/auth
Parameter(POST)
Id (required):distribution ID
Password (required) : password
Return value(XML)
res_result : Process result status(OK/NG)
api_key : API Key
Error code
0000 : Failed to get POST data
1101 : Authentication failed
1102 : Registration failed
9998 : Under maintenance now. Please try again later.
Remark
The API key will expire after 24 hours of inactivity.

Sample

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form action="https://typesquare.com/en/api/auth/" method="post">
<p>id: <input type="text" name="id"></p>
<p>password: <input type="password" name="password"></p>
<p><input type="submit" name="submit" value="send"></p>
</form>
</body>
</html>

Enter the distribution ID and password and click send.

Register URL

Function
Register site for TypeSquare use
URL
https://typesquare.com/en/api/service
Parameter(POST)
method : typesquare.regist.url
api_key : API Key
url_text : URL to be registered
Return value(XML)
res_result : Process result status(OK/NG)
res_err_code : Error code
Error code
0000 : Failed to get POST data
0001 : Bad API method
0002 : Authentication failed. The API key is invalid or expired. Perform authentication again.
1301 : Base64 encode failure
1302 : URL is already registered
1303 : Failed to get contract information
1304 : Maximum number of URLs exceeded
1305 : URL registration failed.
1306 : Failed to register distribute authentication
1307 : URL contains illegal characters
9998 : Under maintenance now. Please try again later.
Remark
The URL to be registered must be base64 encoded.

Sample

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="base64v1_0.js"></script>
<script type="text/javascript">
encode_url = function(name) {
document.getElementsByName(name)[0].value = B64.encode(document.getElementsByName(name)[0].value);
}
</script>
</head>
<body>
<form action="https://typesquare.com/en/api/service/" method="post">
<p>method: <input type="text" name="method" value="typesquare.regist.url"></p>
<p>api_key: <input type="text" name="api_key"></p>
<p>Registrationurl: <input type="text" name="url_text"><input type="button" value="base64 encode" onclick="encode_url('url_text');"></p>
<p><input type="submit" name="submit" value="send"></p>
</form>
</body>
</html>

* base64v1_0.js used in the sample can be found at the following Apache License 2.0 URL:
https://github.com/infowrap/base64/

Enter api_key and registration URL. Click "base64 encode" button to convert the registration URL and then click send.

Release URL

Function
Remove TypeSquare registration for a URL
URL
https://typesquare.com/en/api/service
Parameter(POST)
method : typesquare.delete.url
api_key : API Key
url_text : URL to be released
Return value(XML)
res_result : Process result status(OK/NG)
res_err_code : Error code
Error code
0000 : Failed to get POST data
0001 : Bad API method
0002 : Authentication failed. The API key is invalid or expired. Perform authentication again.
1401 : Base64 encode failure
1402 : Could not find URL
1403 : Failed to release URL
1404 : Failed to remove distribution authentication
9998 : Under maintenance now. Please try again later.
Remark
The URL to be released must be base64 encoded.

Sample

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="base64v1_0.js"></script>
<script type="text/javascript">
encode_url = function(name) {
document.getElementsByName(name)[0].value = B64.encode(document.getElementsByName(name)[0].value);
}
</script>
</head>
<body>
<form action="https://typesquare.com/en/api/service/" method="post">
<p>method: <input type="text" name="method" value="typesquare.delete.url"></p>
<p>api_key: <input type="text" name="api_key"></p>
<p>Deleteurl: <input type="text" name="url_text"><input type="button" value="base64 encode" onclick="encode_url('url_text');"></p>
<p><input type="submit" name="submit" value="send"></p>
</form>
</body>
</html>

* base64v1_0.js used in the sample can be found at the following Apache License 2.0 URL:
https://github.com/infowrap/base64/

Enter api_key and delete URL. Click "base64 encode" to convert the delete URL and then click send.

Get list of registered URLs

Function
Get list of registered URLs
URL
https://typesquare.com/en/api/service
Parameter(POST)
method (Required) : typesquare.get.url
api_key (Required) : API Key
Return value(XML)
res_result : Process result status(OK/NG)
dtls : List of registered URLs
res_err_code : Error code
Error code
0000 : Failed to get POST data
0001 : Bad API method
0002 : Authentication failed. The API key is invalid or expired. Perform authentication again.
1201: Failed to get registered URL
9998 : Under maintenance now. Please try again later.
Remark
The URLs returned are base64 encoded.

Sample

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form action="https://typesquare.com/en/api/service/" method="post">
<p>method: <input type="text" name="method" value="typesquare.get.url"></p>
<p>api_key: <input type="text" name="api_key"></p>
<p><input type="submit" name="submit" value="send"></p>
</form>
</body>
</html>

Enter API key and click send.

Get the PV (page views) for a site in a given date range

Function
Obtain the number of page views a site has received in a given date range.
URL
https://typesquare.com/en/api/service
Parameter(POST)
method (Required) : typesquare.get.pv
api_key (Required) : API Key
url_text (Optional) : Registration URL
start_date (Required) : Start date(YYYYMMDD)
end_date (Required) : End date(YYYYMMDD)
Return value(XML)
res_result : Process result status(OK/NG)
dtls : Operation result (see sample result below)
res_err_code : Error code
Error code
0000 : Failed to get POST data
0001 : Bad API method
0002 : Authentication failed. The API key is invalid or expired. Perform authentication again.
1501 : Failed to check specified term
1502 : Base64 encode failure
9998 : Under maintenance now. Please try again later.
Remark
The URL must be base64 encoded..
The returned URL is base64 encoded.

Sample

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="base64v1_0.js"></script>
<script type="text/javascript">
encode_url = function(name) {
document.getElementsByName(name)[0].value = B64.encode(document.getElementsByName(name)[0].value);
}
</script>
</head>
<body>
<form action="https://typesquare.com/en/api/service/" method="post">
<p>method: <input type="text" name="method" value="typesquare.get.pv"></p>
<p>api_key: <input type="text" name="api_key"></p>
<p>targeturl: <input type="text" name="url_text"><input type="button" value="base64 encode" onclick="encode_url('url_text');"></p>
<p>Start date: <input type="text" name="start_date" placeholder="YYYYMMDD"></p>
<p>End date: <input type="text" name="end_date" placeholder="YYYYMMDD"></p>
<p><input type="submit" name="submit" value="send"></p>
</form>
</body>
</html>

* base64v1_0.js used in the sample can be found at the following Apache License 2.0 URL:
https://github.com/infowrap/base64/

Enter the api_key, target URL, start date, and end date. Click "base64 encode" to convert the target and then click send.

Get font list

Function
Acquire a list of the fonts that meet the specified conditions.
URL
https://typesquare.com/en/api/service
Parameter(POST)
method (Required) : typesquare.get.font
api_key (Required) : API Key
fontname (Optional) : Typeface name (example: Midashi Min)
familyname (Optional) : Family name (example: midashi min)
fontmaker (Optional) : Manufacturer name (example: Morisawa)
familystyle (Optional) : Type face classification (example: Mincho/Gothic)
weight (Optional) : Weight (example: light/medium/bold/extra-bold)
language (Optional) : Language (example: Japanese)
Return value(XML)
res_result : Process result status(OK/NG)
dtls : Fonts that match the given specification
res_err_code : Error code
Error code
0000 : Failed to get POST data
0001 : Bad API method
0002 : Authentication failed. The API key is invalid or expired. Perform authentication again.
1701 : Base64 encode failure (Font name)
1702 : Base64 encode failure (Font family name)
1703 : Base64 encode failure (Font vender name)
1704 : Base64 encode failure (Font classification)
1705 : Base64 encode failure (Font weight)
1706 : Base64 encode failure (Language)
1707 : Font does not exist
9998 : Under maintenance now. Please try again later.
Remark
The font name, font family, manufacturer name, classification, weight, and language must all be base64 encoded.
All condition settings are optional. If a condition is specified, only those fonts with an exact match will be returned.

Sample

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="base64v1_0.js"></script>
<script type="text/javascript">
encode_url = function(name) {
document.getElementsByName(name)[0].value = B64.encode(document.getElementsByName(name)[0].value);
}
encode_all = function() {
encode_url('fontname');
encode_url('familyname');
encode_url('fontmaker');
encode_url('familystyle');
encode_url('weight');
encode_url('language');
}
</script>
</head>
<body>
<form action="https://typesquare.com/en/api/service/" method="post">
<p>method: <input type="text" name="method" value="typesquare.get.font"></p>
<p>api_key: <input type="text" name="api_key"></p>
<p>Typeface name: <input type="text" name="fontname"></p>
<p>Family name: <input type="text" name="familyname"></p>
<p>Manufacturer name: <input type="text" name="fontmaker"></p>
<p>Typeface classification: <input type="text" name="familystyle"></p>
<p>Weight: <input type="text" name="weight"></p>
<p>Language: <input type="text" name="language"></p>
<p><input type="button" value="base64 encode" onclick="encode_all();"></p>
<p><input type="submit" name="submit" value="send"></p>
</form>
</body>
</html>

* base64v1_0.js used in the sample can be found at the following Apache License 2.0 URL:
https://github.com/infowrap/base64/

Enter api_key and optional refined item. Click "base64 encode" to convert the target and then click send.