-
Notifications
You must be signed in to change notification settings - Fork 11
API search
Template for this request:
http://codepoints.net/api/v1/search{?properties}{&page}{&per_page}{&callback}
with {?properties} one or several key/value pairs of Unicode properties or
int for decimal codepoint values or q for free text search. This API
exposes the functionality of the main site’s search.
{?callback} is an optional callback function name to perform a JSON-P
request.
The responding set of codepoints is paged so that a maximum of 1000 codepoints
is displayed at once. You can opt for fewer codepoints with the per_page GET
parameter.
A response for the request to /api/v1/search?q=heart&per_page=5 looks
like this:
{
"page": 1,
"last_page": 22,
"per_page": 5,
"count": 109,
"result": [
8711,
9167,
9753,
9824,
9825
]
}page denotes the current page in paged results. last_page is the last page
number in paged results. per_page shows, how many codepoints are shown per
page, count is the number of all codepoints matching the query. result
finally is an array of integers, which represent the codepoints in the result
set.
A successful response will contain four to five Link headers:
-
rel=alternatelinks to the HTML view of the search result on the main site. -
rel=firstlinks to the first page of the result set. This is always present. -
rel=prevlinks to the previous page, if it exists. -
rel=nextlinks to the next page, if it exists. -
rel=firstlinks to the last page of the result set. This is always present.
This API endpoint should not throw any errors. An empty search result looks like this:
{
"page": 1,
"last_page": 1,
"per_page": 1000,
"count": 0,
"result": [ ]
}