ဖောင့်အမည် API
letterform ဂုဏ်သတ္တိများသို့မဟုတ်ပုံရိပ်ကနေဖောင့်ကိုခွဲခြားသိမြင်, အခမဲ့ open-source fonts များ၏စာအုပ်ဆိုင်တစ်အုပ်ကိုဆန့်ကျင် matched. ဒီ site ပေါ်တွင်လူသားများအတွက်အခမဲ့ - ဒီ API ကို programmatic နှင့် bulk အသုံးပြုမှုများအတွက်ဖြစ်ပါသည်.
အဆုံးသတ်ချက်
POST https://fonts.free/api/identify/
နှစ် mode ကို. JSON အဖြစ် wizard အဖြေများကိုပို့, သို့မဟုတ် multipart form ကို data အဖြစ်ပုံရိပ်တစ်ပုံရိပ်. add?top=N (1-48) ဘယ်လောက်ပြန်လာ match ကို set ဖို့.
1. letterform အရည်အချင်းများအားဖြင့်
curl -X POST "https://fonts.free/api/identify/?top=8" \
-H "Content-Type: application/json" \
-d '{"answers": {"serif": ["none"], "contrast": ["low"], "a": ["double"]}}'
2. ပုံရိပ်တစ်ခုမှ (beta)
curl -X POST "https://fonts.free/api/identify/" \
-F "image=@sample.png"
Python
import requests
H = {"X-Api-Key": "your_key"}
# by traits
r = requests.post("https://fonts.free/api/identify/?top=8", headers=H,
json={"answers": {"serif": ["none"], "contrast": ["low"]}})
# from an image
r = requests.post("https://fonts.free/api/identify/", headers=H,
files={"image": open("sample.png", "rb")})
for m in r.json()["matches"]:
print(m["family"], m["score"], m["url"])
တုံ့ပြန်မှု
{
"ok": true,
"mode": "wizard",
"matches": [
{"slug": "roboto", "family": "Roboto",
"url": "https://fonts.free/fonts/roboto/",
"css": "…", "score": 3}
]
}
အတည်ပြုခြင်းနှင့် ကနဦးသတ်မှတ်ချက်
key ကိုမရှိဘဲ endpoint အလုပ်လုပ်ပေမယ့် IP ကိုတစ်ဦးလျှင်နှုန်း-ကန့်သတ်သည် - အပြင်ကိုကြိုးစားဖို့ကောင်းတဲ့အတွက်. key ကိုတစ်လတစ်လ quota ကိုဆန့်ကျင်သင့်ရဲ့အကန့်အသတ်ကိုတက်. header သို့မဟုတ် query parameter ကိုအဖြစ်ပို့:
-H "X-Api-Key: your_key" # or ?key=your_key
စီမံချက်
အလင်းအသုံးပြုမှုအတွက်လိုအပ်သော key ကိုမရှိပါ။ prototypes နှင့်အနည်းငယ်-volume tools များအဘို့ကြီးမားသော။
ထုတ်လုပ်မှု apps များနှင့် batch အသိအမှတ်ပြုမှုများအတွက်။
မြင့်မားသော-throughput သို့မဟုတ် embedded အသုံးပြုမှု။ အလိုအလျောက်ချိန်းတွေ့။
စီမံကိန်းများကြည့်ရှုနှင့် subscribe
အဆိုပါအခမဲ့အလွှာ key ကိုမလိုအပ်ပါဘူး - ရုံ endpoint ကိုခေါ်ဆို, ဒါဟာ IP ကိုတစ်ဦးလျှင်နှုန်းထား-ကန့်သတ်ဖြစ်ပါသည်. မြင့်မားသောလစဉ် quota နှင့်အတူ key ကိုများအတွက်စျေးနှုန်းစာမျက်နှာပေါ်တွင် subscribe. အားလုံး match the API returns is an free, open-licensed font, so there is nothing to license downstream.