Inside the testFiles folder, there are two zip files, we will use the motorBike.zip file for this
Open the config.json file that is inside the folder /src/config.
And add your credentials into the file:
And finally, execute the following command to run the example project:
The example project will use the credentials stored in the config.json file to log in into the
KaleidoSim API. The code will then execute the following steps using the API:
Create a project.
- Upload an input file.
- Create a simulation case.
- Run the case.
- Wait for the simulation to complete.
- After the simulation is complete, it downloads the results into a local folder.
You can find the main sequence of these events in createCompleteCase.js file. By following
the function calls leading from this file, you can see how the API is utilised. As an example of
this please look at the create project function inside the src/api-requests/projects/ folder,
you can see that we are making a POST request to the API in order to create a new project,
the API will return in response the projectId of the newly created project.
One interesting thing to note is how we are checking to see if the simulation case has
completed. You can see that we are periodically polling the API in the runCase.js file where
we make a request to get the current status of the simulation. Once the case completes we
move onto the file downloading phase in src/downloadCaseFiles.js.
The simulation created by the example project is also visible in the KaleidoSim Cloud