コンテンツにスキップ

WebAPI - イントロダクション

まずはcurlを使いWebAPIでリスクマップが取得できることを確認します。

認証

NICTが提供するxData プラットフォームを使用する場合、NICTが発行するAPIキーとシークレットを利用する必要があります。 xData Edgeを用いて環境を構築した場合、デフォルトのAPIキーとシークレットは こちらに記載の方法で確認する事ができます。
APIキーとシークレットはHTTPリクエスト送信時のHTTPヘッダ部に、それぞれ下記のヘッダ名で送信する必要があります。

  • APIキー:APIKey
  • シークレット:Secret

リクエストの発行

NICTが提供するxData プラットフォームで使用する場合、エンドポイントは提供者が通知したURLを使用してください。xData Edgeを用いて環境を構築した場合、Edge VM上ではエンドポイントはlocalhostです。
以下はターミナルからAPIを実行し、xData Edgeからリスクマップを取得する例です。

curl https://<api-server-endpoint>/api/v1/evwhapi/jsonrpc \
-i \
-H "Content-type:application/json" \
-H "APIKey: 0df23f0d-44cb-4085-8ac9-158e6ced3056" \
-H "Secret: 4AzbY3pvfes33aow49nhjn3aUphv9zFWctcT" \
-X POST \
-d '{"id": "test-extra", \
  "jsonrpc": "2.0", \
  "method": "mapserv.riskmap", \
  "params": { \
    "type": "Feature", \
    "geometry":{"type":"Polygon","coordinates":[[[139.75625,35.675],[139.75625,35.695833333333],[139.784375,35.695833333333],[139.784375,35.675],[139.75625,35.675]]]}, \
    "properties": {"themes": ["myjartic1"], "start_datetime": "2014-01-01 00:55:00+09", "target_theme_mesh_degree": 5} \
}}'

以下のような結果が返ります。

{"result": {"type": "FeatureCollection", "name": "requestExtraRiskmapResponse", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[139.765625, 35.677083333333], [139.76875, 35.677083333333], [139.76875, 35.679166666667], [139.765625, 35.679166666667], [139.765625, 35.677083333333]]]}, "properties": {"theme": "myjartic1", "datetime": "2014-01-01T00:55:00+09:00", "risk": 5}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[139.765625, 35.691666666667], [139.76875, 35.691666666667], [139.76875, 35.69375], [139.765625, 35.69375], [139.765625, 35.691666666667]]]}, "properties": {"theme": "myjartic1", "datetime": "2014-01-01T00:55:00+09:00", "risk": 1}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[139.765625, 35.679166666667], [139.76875, 35.679166666667], [139.76875, 35.68125], [139.765625, 35.68125], [139.765625, 35.679166666667]]]}, "properties": {"theme": "myjartic1", "datetime": "2014-01-01T00:55:00+09:00", "risk": 5}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[139.765625, 35.69375], [139.76875, 35.69375], [139.76875, 35.695833333333], [139.765625, 35.695833333333], [139.765625, 35.69375]]]}, "properties": {"theme": "myjartic1", "datetime": "2014-01-01T00:55:00+09:00", "risk": 1}}]}, "id": "test-extra", "jsonrpc": "2.0"}

EvWHへのアクセス

以後のGetting Startedでは、EvWHのコンテナにアクセスする必要があります。
EvWHのコンテナは環境によって異なるのでkubectl get podsを実行し、evwhdb01から始まるPodを指定してください。psqlでアクセスする際のユーザ名・パスワードはどちらもevwh_adminです。