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


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).

  1. 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

  2. Once integrated into chrome configure the request options as following:
    URL: https://services.cybershare.utep.edu/water/distribuitor/
    Method: POST
    Accept: application/JSON

  3. Copy the sample user scenario input JSON into the request body.

Rest Client Screenshot

  1. Click on the send button.
  2. 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”.

Response Summary

JSON Response

  1. The returned JSON will contain additional attributes such as startedAtTime, endedAtTime and status.
  2. The model output object will include the attribute “varValue” which contains a data structure with generated results for each output variable.

Model Output Sample

Future Updates:

  • Webservice error handlers:
    • Input validation.
    • Missing fields.
    • Parameter values out of bounds.
    • Model execution errors.


[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/