SWIM Webservices Tutorial
SWIM RESTful webservices are implemented using Dropwizard[1]. The current version exposes an endpoint that receives a user scenario specification in JSON format (see data model view for additional information on the user scenario JSON schema).
SWIM currently connects to the March 26 2019 version of the Bucket Model developed with GAMS.
Services Information
Bucket Model Execution Endpoint
Endpoint URL: https://services.cybershare.utep.edu/water/distributor/
Method: POST
Consumes: application/JSON
Produces: application/JSON
Status: Online
Water Balance Model Execution Endpoint (Prototype)
Endpoint URL: https://services.cybershare.utep.edu/swim-scilab/runmodel/
Method: POST
Consumes: application/JSON
Produces: application/JSON
Status: Online
Testing
Note: The following section is outdated... stay tunned for new sample files to try out our webservices!
To try out our webservice by downloading a JSON input sample here. (Pending new sample update).
-
The service can be requested programmatically or via clients with HTTP request capabilities. As a sample we show how to invoke the webservice using the Rest Web Service Client chrome extension which can be installed in google chrome here
-
Once integrated into chrome configure the request options as following:
URL: https://services.cybershare.utep.edu/water/distribuitor/
Method: POST
Accept: application/JSON -
Copy the sample user scenario input JSON into the request body.
- Click on the send button.
- If the execution is successful the service will return a code 200 with an extended JSON as a response and the status attribute as “complete”.
- The returned JSON will contain additional attributes such as startedAtTime, endedAtTime and status.
- The model output object will include the attribute “varValue” which contains a data structure with generated results for each output variable.
Future Updates:
- Webservice error handlers:
- Input validation.
- Missing fields.
- Parameter values out of bounds.
- Model execution errors.
References
[1] DropWizard - http://www.dropwizard.io/1.1.4/docs/
[2] Maven - https://maven.apache.org/
[3] Gams - The General Algebraic Modeling System - https://www.gams.com/
[4] Scilab - Scilab - https://www.scilab.org/