-
Notifications
You must be signed in to change notification settings - Fork 11
API
Manuel Strehl edited this page Jul 14, 2013
·
11 revisions
The API of Codepoints.net can be reached at
http://codepoints.net/api/v1/
It is a REST API giving access to Unicode data. Mostly, JSON will be returned. In the case of an error the API adheres to the Problem Details for HTTP APIs draft specification. What this means concretely is detailed on the errors description page.
The API sends a CORS header to allow true cross-domain requests in newer browsers.
- Request one codepoint
- Information about a Unicode block
- Information about a Unicode plane
- Request a sample glyph (This endpoint returns a PNG image.)
- Request a codepoint’s name only
- Value of a single property for all codepoints (This endpoint returns a PNG image.)
- Information about a script
- Transform a string (e.g., uppercase, NFC, …)
- Filter a string (e.g., by Unicode version or only uppercase letters)
A typical request has the following form:
GET /api/v1/codepoint/1234?property=cp,na,age HTTP/1.1
Host: codepoints.net
Accept: application/json
Accept-Language: en
And the API response is shaped like this:
HTTP/1.1 200 OK
Date: Sun, 14 Jul 2013 20:19:19 GMT
Access-Control-Allow-Origin: *
Content-Language: en
Content-Type: application/json; charset=UTF-8
Last-Modified: Mon, 08 Jul 2013 23:21:20 +0200
Link: <http://codepoints.net/U+1234>; rel=alternate
Link: <http://codepoints.net/api/v1/block/ethiopic>; rel=up
Link: <http://codepoints.net/api/v1/codepoint/1235>; rel=next
Link: <http://codepoints.net/api/v1/codepoint/1233>; rel=prev
Unicode-Version: 6.1.0
{"cp":"4660","age":"3.0","na":"ETHIOPIC SYLLABLE SEE"}
There are three note-worthy headers here:
- The
Link
headers allow access to the previous and next codepoint as well as to the containing Unicode block. - The custom header
Unicode-Version
gives the precise Unicode version this answer is valid for. - The
Last-Modified
header is appropriately set to allow client-side caching of the API response.