Skip to content

demo client API

Muharem Hrnjadovic edited this page Apr 27, 2011 · 25 revisions

The OpenQuake django server application exposes the following set of api endpoints for use by the GeoExt client.

^openquake/ ^model_upload/$
^openquake/ ^hazard_risk_calc/$
^openquake/ ^hazard_risk_result/$

model_upload

POST

Allows the user to upload a NRML file with seismic input model data. Makes use of a multipart/form-data

Form parameters:

  • input_file: the file content

The content type of the returned data needs to be text/html.

http://openquake.gemsun02.ethz.ch/openquake/model_upload/

{"status": "success", "msg": "Model upload successful",
 "ruptures": [33, 17], "sources": [49, 51]}

hazard_risk_calc

POST

Allows the user to start a combined hazard/risk OpenQuake engine calculation given the chosen geometry and a small selection of calculation parameters.

TODO:

  • what hazard/risk calculation parameters should be supported by the GUI?

http://openquake.gemsun02.ethz.ch/openquake/hazard_risk_calc/

{
    "model": "openquake.calculationparams",
    "fields": {
        "x": 3,
        "y": 0,
        "z": 1
    }
}

Response data:

{"status": "success", "msg": "Calculation started", "id": 123}

hazard_risk_result

GET

TODO:

  • clarify whether maps should be rendered using fixed or stretched classifications.

Allows clients to obtain the results of the given OpenQuake calculation.

http://openquake.gemsun02.ethz.ch/openquake/hazard_risk_result/123/

Response data (TODO: add min/max for stretched classifications):

{
    "pk": 123,
    "model": "openquake.calculationresults",
    "fields": {
        "hazardcurves": ["123-hazardcurve.svg-1", "123-hazardcurve.svg-2"],
        "losscurves": ["123-losscurve.svg"],
    }
}

Response codes:

  • 400: when result not available yet
  • 200: when the result is available
Clone this wiki locally