じゃらんWebサービス
apiTag:
api provider:
api:
じゃらん宿表示API, 空室検索API, エリア検索API, 温泉検索API
example:
エリアコード一覧の取得
$ curl -sS "http://www.jalan.net/jalan/doc/jws/data/area.xml" | xmllint --format - | head <?xml version="1.0" encoding="UTF-8"?> <Area> <Prefecture cd="010000" name="北海道"> <LargeArea cd="010200" name="札幌"> <SmallArea cd="010202" name="ススキノ・大通"/> <SmallArea cd="010205" name="北大・丘珠"/> <SmallArea cd="010208" name="琴似・テイネ"/> <SmallArea cd="010211" name="厚別・白石・豊平"/> <SmallArea cd="010214" name="真駒内"/> </LargeArea>
広域コード
$ curl -sS "http://jws.jalan.net/APICommon/AreaSearch/V1/?key=[APIキー]" | xml2json | jq -r '.Results.Area.Region[] | [.cd,.name] | @csv' "01","北海道" "05","東北" "10","北関東" "15","首都圏" "20","甲信越" "25","北陸" "30","東海" "35","近畿" "40","山陰・山陽" "45","四国" "50","九州" "55","沖縄"
都道府県コード
$ curl -sS "http://www.jalan.net/jalan/doc/jws/data/area.xml" | xml2json | jq -r '.Area.Prefecture[] | [.cd, .name] | @csv' | tee PrefectureData.csv | head "010000","北海道" "020000","青森県" "030000","岩手県" "040000","宮城県" "050000","秋田県" "060000","山形県" "070000","福島県" "080000","栃木県" "090000","群馬県" "100000","茨城県" $ echo "prefecturecd,prefecturename" | cat - PrefectureData.csv > prefecture.csv # ヘッダー追加
LargeArea CSV作成
$ curl -sS "http://www.jalan.net/jalan/doc/jws/data/area.xml" | xml2json | jq -r '.Area.Prefecture[] | {PrefectureCd: .cd, PrefectureName: .name, LargeArea: .LargeArea[]} | [.PrefectureCd, .PrefectureName, .LargeArea.cd, .LargeArea.name] | @csv' | tee LargeAreaData.csv | head "010000","北海道","010200","札幌" "010000","北海道","010300","定山渓" "010000","北海道","010500","小樽・キロロ・積丹" "010000","北海道","010800","ニセコ・ルスツ" "010000","北海道","011100","洞爺・登別・苫小牧" "010000","北海道","011400","函館・大沼・松前" "010000","北海道","011700","稚内・留萌" "010000","北海道","012000","旭川・層雲峡" "010000","北海道","012100","富良野・美瑛・トマム" "010000","北海道","012300","網走・北見・知床" $ echo "prefecturecd,prefecturename,largeareacd,largeareaname" | cat - LargeAreaData.csv > largearea.csv # ヘッダー追加 $ wc -l largearea.csv 77 largearea.csv
沖縄県の温泉10件。
$ curl -sS "http://jws.jalan.net/APICommon/OnsenSearch/V1/?key=[APIキー]&pref=470000&count=10&xml_ptn=0" | xmllint --format - -:2: namespace warning : xmlns: URI jws is not absolute <Results xmlns="jws"><NumberOfResults>9</NumberOfResults><DisplayPerPage>9</Disp ^ <?xml version="1.0" encoding="UTF-8"?> <Results xmlns="jws"> <NumberOfResults>9</NumberOfResults> <DisplayPerPage>9</DisplayPerPage> <DisplayFrom>1</DisplayFrom> <APIVersion>1.1</APIVersion> <Onsen> <OnsenName>山田温泉</OnsenName> <OnsenNameKana>やまだおんせん</OnsenNameKana> <OnsenID>1980</OnsenID> <OnsenAddress>沖縄県国頭郡恩納村山田</OnsenAddress> <Area> <Region>沖縄</Region> <Prefecture>沖縄県</Prefecture> <LargeArea>西海岸・東海岸</LargeArea> <SmallArea>西海岸</SmallArea> </Area> <NatureOfOnsen>硫黄泉</NatureOfOnsen> <OnsenAreaID>50453</OnsenAreaID> </Onsen> <Onsen> <OnsenName>三重城温泉</OnsenName> <OnsenNameKana>みいぐすくおんせん</OnsenNameKana> <OnsenID>1981</OnsenID> <OnsenAddress>沖縄県那覇市西3-2-1</OnsenAddress> <Area> <Region>沖縄</Region> <Prefecture>沖縄県</Prefecture> <LargeArea>那覇</LargeArea> <SmallArea>那覇</SmallArea> </Area> <OnsenAreaID>50946</OnsenAreaID> </Onsen> <Onsen> <OnsenName>サザンリンクスリゾートホテル温泉</OnsenName> <OnsenNameKana>さざんりんくすりぞーとほてるおんせん</OnsenNameKana> <OnsenID>1982</OnsenID> <OnsenAddress>沖縄県島尻郡具志頭村字玻名城</OnsenAddress> <Area> <Region>沖縄</Region> <Prefecture>沖縄県</Prefecture> <LargeArea>南部</LargeArea> <SmallArea>島尻</SmallArea> </Area> <NatureOfOnsen>塩化物泉</NatureOfOnsen> <OnsenAreaID/> </Onsen> <Onsen> <OnsenName>西表島温泉</OnsenName> <OnsenNameKana>いりおもてじまおんせん</OnsenNameKana> <OnsenID>2493</OnsenID> <OnsenAddress>沖縄県八重山郡竹富町高那243</OnsenAddress> <Area> <Region>沖縄</Region> <Prefecture>沖縄県</Prefecture> <LargeArea>離島</LargeArea> <SmallArea>西表島・小浜島・竹富島</SmallArea> </Area> <NatureOfOnsen>中性低張性高温泉</NatureOfOnsen> <NatureOfOnsen>ナトリウム塩化物泉</NatureOfOnsen> <NatureOfOnsen>硫酸塩泉</NatureOfOnsen> <OnsenAreaID>50759</OnsenAreaID> </Onsen> <Onsen> <OnsenName>シギラ黄金温泉</OnsenName> <OnsenNameKana>しぎらおうごんおんせん</OnsenNameKana> <OnsenID>3000</OnsenID> <OnsenAddress>沖縄県宮古島市上野字新里西本島1405-223</OnsenAddress> <Area> <Region>沖縄</Region> <Prefecture>沖縄県</Prefecture> <LargeArea>離島</LargeArea> <SmallArea>宮古島</SmallArea> </Area> <NatureOfOnsen>弱アルカリ性低張性泉</NatureOfOnsen> <NatureOfOnsen>ナトリウム塩化物泉</NatureOfOnsen> <OnsenAreaID>50816</OnsenAreaID> </Onsen> <Onsen> <OnsenName>天然温泉さしきの猿人の湯</OnsenName> <OnsenNameKana>てんねんおんせんさしきのえんじんのゆ</OnsenNameKana> <OnsenID>3105</OnsenID> <OnsenAddress>沖縄県南城市佐敷字新里1688</OnsenAddress> <Area> <Region>沖縄</Region> <Prefecture>沖縄県</Prefecture> <LargeArea>南部</LargeArea> <SmallArea>島尻</SmallArea> </Area> <NatureOfOnsen>ナトリウム塩化物泉</NatureOfOnsen> <OnsenAreaID>50897</OnsenAreaID> </Onsen> <Onsen> <OnsenName>琉球温泉</OnsenName> <OnsenNameKana>りゅうきゅうおんせん</OnsenNameKana> <OnsenID>3134</OnsenID> <OnsenAddress>沖縄県豊見城市瀬長174番地52</OnsenAddress> <Area> <Region>沖縄</Region> <Prefecture>沖縄県</Prefecture> <LargeArea>南部</LargeArea> <SmallArea>糸満</SmallArea> </Area> <NatureOfOnsen>ナトリウム塩化物泉</NatureOfOnsen> <OnsenAreaID>50924</OnsenAreaID> </Onsen> <Onsen> <OnsenName>ジュラ紀温泉 美ら海の湯</OnsenName> <OnsenNameKana>じゅらきおんせん ちゅらうみのゆ</OnsenNameKana> <OnsenID>3162</OnsenID> <OnsenAddress>沖縄県国頭郡本部町字備瀬小浜原136番地1</OnsenAddress> <Area> <Region>沖縄</Region> <Prefecture>沖縄県</Prefecture> <LargeArea>本部・名護・国頭</LargeArea> <SmallArea>本部・伊江島・水納島</SmallArea> </Area> <NatureOfOnsen>ナトリウム塩化物泉</NatureOfOnsen> <OnsenAreaID>50935</OnsenAreaID> </Onsen> <Onsen> <OnsenName>ちゃたん恵み温泉 美浜の湯</OnsenName> <OnsenNameKana>ちゃたんめぐみおんせん みはまのゆ</OnsenNameKana> <OnsenID>3187</OnsenID> <OnsenAddress>沖縄県中頭郡北谷町字美浜2番地</OnsenAddress> <Area> <Region>沖縄</Region> <Prefecture>沖縄県</Prefecture> <LargeArea>沖縄市(コザ)・北谷・宜野湾</LargeArea> <SmallArea>北谷・嘉手納</SmallArea> </Area> <NatureOfOnsen>炭酸水素塩泉</NatureOfOnsen> <NatureOfOnsen>その他</NatureOfOnsen> <OnsenAreaID>50948</OnsenAreaID> </Onsen> </Results>
SmallArea CSV
$ curl -sS "http://www.jalan.net/jalan/doc/jws/data/area.xml" | xml2json | jq '.Area.Prefecture[].LargeArea[]' | jq -r '{LargeAreaCd: .cd, LargeAreaName: .name, SmallArea: .SmallArea[]} | [.LargeAreaCd, .LargeAreaName, .SmallArea.cd, .SmallArea.name] | @csv' > SmallAreaData1.csv $ curl -sS "http://www.jalan.net/jalan/doc/jws/data/area.xml" | xml2json | jq '.Area.Prefecture[].LargeArea[]' | jq -r '{LargeAreaCd: .cd, LargeAreaName: .name, SmallArea: .SmallArea} | [.LargeAreaCd, .LargeAreaName, .SmallArea.cd, .SmallArea.name] | @csv' > SmallAreaData2.csv $ echo "largeareacd,largeareaname,smallareacd,smallareaname" | cat - SmallAreaData1.csv SmallAreaData2.csv > smallarea.csv $ (head;tail) < smallarea.csv largeareacd,largeareaname,smallareacd,smallareaname "010200","札幌","010202","ススキノ・大通" "010200","札幌","010205","北大・丘珠" "010200","札幌","010208","琴似・テイネ" "010200","札幌","010211","厚別・白石・豊平" "010200","札幌","010214","真駒内" "010500","小樽・キロロ・積丹","010502","小樽" "010500","小樽・キロロ・積丹","010505","余市・キロロ" "010500","小樽・キロロ・積丹","010508","積丹" "010800","ニセコ・ルスツ","010802","ニセコ・倶知安" "411300","伊万里・有田","411302","伊万里・有田" "430800","八代・水俣・湯の児","430802","八代・水俣・湯の児" "430900","人吉・球磨","430902","人吉・球磨" "440500","別府","440502","別府" "440600","湯布院","440602","湯布院・湯平" "441100","日田・天ヶ瀬・耶馬渓","441102","日田・天ヶ瀬" "450300","えびの・都城","450302","えびの・都城" "460200","鹿児島・桜島","460202","鹿児島・桜島" "460800","垂水・大隅","460802","垂水・大隅" "461100","霧島","461102","霧島" $ wc -l smallarea.csv 681 smallarea.csv