MyAPIs v0.1.0
https://apis-cloud.net

12星座API

西洋占星術の12星座。期間・四大元素(火地風水)・三区分・支配星つき。

エンドポイントhttps://apis-cloud.net/horoscope
件数12 件
形式JSON(UTF-8)
認証不要(CORS 全オリジン許可)
ID フィールドnameorder kana latin english でも引ける)
検索対象name kana latin english element ruler
リクエスト
curl -s "https://apis-cloud.net/horoscope/1"
const res = await fetch("https://apis-cloud.net/horoscope/1");
const data = await res.json();
import urllib.request, json

with urllib.request.urlopen("https://apis-cloud.net/horoscope/1") as r:
    data = json.load(r)
レスポンス 200 OK
{
  "order": 1,
  "name": "牡羊座",
  "kana": "おひつじざ",
  "latin": "Aries",
  "english": "Ram",
  "symbol": "♈",
  "from": "3月21日",
  "to": "4月19日",
  "element": "火",
  "quality": "活動宮",
  "ruler": "火星"
}

エンドポイント

12星座APIは、他のリソースと同じ共通の形をしている。 パラメータの詳しい説明は 共通エンドポイントの節 にある。

GET/horoscope メタ情報(件数・フィールド・エンドポイント)
GET/horoscope/all 全12件
GET/horoscope/random ランダムに1件
GET/horoscope/search?q=牡羊 部分一致検索
GET/horoscope/fields フィールド名の一覧
GET/horoscope/getName name の列だけ取り出す
GET/horoscope/1 ID 指定で1件
GET/horoscope/1/name 1件の特定フィールド
全件取得
curl -s "https://apis-cloud.net/horoscope/all?limit=3"
const res = await fetch("https://apis-cloud.net/horoscope/all?limit=3");
const data = await res.json();
import urllib.request, json

with urllib.request.urlopen("https://apis-cloud.net/horoscope/all?limit=3") as r:
    data = json.load(r)

フィールド

1レコードは次の 11 個のフィールドを持つ。値の例は実際の1件目から取っている。

ordernumber1
namestring牡羊座
kanastringおひつじざ
latinstringAries
englishstringRam
symbolstring
fromstring3月21日
tostring4月19日
elementstring
qualitystring活動宮
rulerstring火星
必要な列だけ取得
curl -s "https://apis-cloud.net/horoscope/all?fields=order,name&limit=3"
const res = await fetch("https://apis-cloud.net/horoscope/all?fields=order,name&limit=3");
const data = await res.json();
import urllib.request, json

with urllib.request.urlopen("https://apis-cloud.net/horoscope/all?fields=order,name&limit=3") as r:
    data = json.load(r)

使用例

GET/horoscope/獅子座
GET/horoscope/Leo
GET/horoscope/5
GET/horoscope/random
GET/horoscope/search?q=火
GET/horoscope/getLatin
ランダムに3件(seed 固定)
curl -s "https://apis-cloud.net/horoscope/random?count=3&seed=demo"
const res = await fetch("https://apis-cloud.net/horoscope/random?count=3&seed=demo");
const data = await res.json();
import urllib.request, json

with urllib.request.urlopen("https://apis-cloud.net/horoscope/random?count=3&seed=demo") as r:
    data = json.load(r)

12星座APIのよくある質問

12星座の一覧はどう取得しますか?
GET https://apis-cloud.net/horoscope/all で全12件がJSONで返ります。1件だけ欲しいときは /horoscope/random、ID を指定するときは /horoscope/{name} を使います。
12星座APIに認証は必要ですか?
不要です。API キーもトークンもなく、GET するだけで使えます。CORS も全オリジンに開けているのでブラウザから直接呼べます。
12星座APIにはどんなフィールドがありますか?
order、name、kana、latin、english、symbol、from、to、element、quality、ruler の 11 個です。?fields= で必要な列だけに絞れます。検索は name、kana、latin、english、element、ruler が対象です。

他のAPI