Restful API for the core backend services of the Sustainable Water Through Integrated Modeling Platform.
This API provides a programmatic interface for the SWIM modeling database, user database and logger database.
The endpoint paths are grouped as following:
- /swim-api : Modeling database operations. (SWIM-DATA)
- /swim-auth-api: User registration and authentication. (SWIM-AUTH)
- /swim-logger-api: Platform event and execution logs. (SWIM-LOGGER)
The SWIM 2 API endpoints require user authentication through JSON Web Tokens.
You will need to have a user account linked to the user database.
- For the SWIM production platform you can register an account at https://swim.cybershare.utep.edu
- Once you are registered you can generate a token through the /swim-auth-api/authenticate endpoint (see swagger doc).
- The endpoint will provide a JWT token.
- Copy the token string (after JWT string) and paste it on the value field available on the Authorize window.
- Endpoint requests will now include your access token.
- Some endpoints might require additional access level, contact the sysadmin to obtain access.
- Node JS v12 and above
- npm v6 and above
- All dependencies managed via package.json
- Download the docker-composer.yml file to a path in your machine.
- Install Docker and Docker composer on your target machine.
- Setup your docker account at: https://www.docker.com/get-started
- Configure the docker-composer file with your own app settings.
- Run docker compose: $docker-compose up
5a. Use -d option on the composer command to run on the background. - Swagger docs available at http://localhost:9110/api-docs
- Download this repository into a folder on your machine.
- Install Docker and Docker composer on your target machine.
- Setup your docker account at: https://www.docker.com/get-started
- Using a command line or terminal navigate to the base path of the project.
- Comment the .env file on the .dockerignore.
- Rename the env file to .env and configure settings as needed.
- Build the image: $docker build -t swim-api-public:latest .
- Run the container: $docker run -p 3000:3000 dockeruser/swim-api-public
- Swagger docs available at http://localhost:3000/api-docs
- Install Node.js for your platform (MacOS, Windows or Linux)
- Download or clone repo to a folder
- Open terminal with path on project folder (or use visual studio)
- Install dependencies from package.json: $npm install
- Rename the env file .env and configure settings as needed.
- Run app: $node server.js
- Swagger docs available at http://localhost:3000/api-docs
SWIM Architecture Docs
SWIM API Docs
Luis A Garnica Chavira
Ian Love
Aaron Zambrano
This material is based upon work supported by the National Science Foundation (NSF) under Grant No. 1835897.
Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
If you create products such as publications using SWIM products, it would be great if you add the following acknowledgement:
"This work used the Sustainable Water for Integrated Modeling (SWIM) 2.0, which was supported by the National Science Foundation under Grant No. 1835897."
Please use the following citation for this product:
Supporting Regional Water Sustainability Decision-Making through Integrated Modeling Garnica Chavira L., Villanueva-Rosales N., Heyman J., Pennington D., Salas K. 2022 IEEE 8th International Smart Cities Conference, Paphos, Cyprus. September 26-29, 2022. DOI 10.1109/ISC255366.2022.9922004
This software code is licensed under the GNU GENERAL PUBLIC LICENSE v3.0 and uses third party libraries that are distributed under their own terms (see LICENSE-3RD-PARTY.md).
© 2019-2023 - University of Texas at El Paso (SWIM Project).