WebAPI - Introduction
Note
This document has been machine translated.
First, verify that you can get a risk map with WebAPI using curl.
Authentication
When using the xData platform provided by NICT, you must use the API key and secret issued by NICT. If you built your environment using xData Edge, the default API key and secret are here.
The API key and secret must be sent in the HTTP header section when sending an HTTP request with the following header names respectively.
- API key: APIKey
- Secret: Secret
Issuing a request
When using the xData platform provided by NICT, the endpoint should be the URL notified by the provider. xData Edge is used to build the environment, the endpoint is localhost on the Edge VM.
Below is an example of running the API from a terminal to get a risk map from 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} \
}}'
The following results are returned
{"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"}
Accessing EvWH
In the subsequent Getting Started, you will need to access the EvWH container.
The EvWH container varies depending on your environment, so please run kubectl get pods and specify the pod starting with evwhdb01. The user name and password for psql access are both evwh_admin.