はじめに
クイックスタート
パートナー登録してAPIキーを作成し、最初のeSIM検索リクエストを送ってみましょう。
APIキーを取得#
- 1esimoaアカウントでログインし、ダッシュボードでパートナー登録します。
- 2APIキーの欄でキーを作成します。一度しか表示されないのですぐに保存してください。
最初のリクエスト#
次のように呼び出すと、日本7日間のeSIMを価格順で取得できます。
curl "https://api.esimoa.com/v1/esims?country=JP&days=7&sort=price&limit=3&lang=en" \
-H "X-API-Key: esk_live_your_key_here"const res = await fetch(
'https://api.esimoa.com/v1/esims?country=JP&days=7&sort=price&limit=3&lang=en',
{ headers: { 'X-API-Key': process.env.ESIMOA_API_KEY } },
);
if (!res.ok) throw new Error(`esimoa API ${res.status}`);
const { items, total } = await res.json();
for (const esim of items) {
console.log(esim.title, esim.priceKrw, esim.url);
}import os
import requests
res = requests.get(
"https://api.esimoa.com/v1/esims",
params={"country": "JP", "days": 7, "sort": "price", "limit": 3, "lang": "en"},
headers={"X-API-Key": os.environ["ESIMOA_API_KEY"]},
timeout=10,
)
res.raise_for_status()
for esim in res.json()["items"]:
print(esim["title"], esim["priceKrw"], esim["url"])レスポンスを読む#
ベースURLは https://api.esimoa.com です。レスポンスはすべてJSONで、金額はウォン(KRW)の整数です。
各商品の url にはパートナーコードが付いています。そのまま掲載すると、そのリンク経由の購入にコミッションが貯まります。
