Web API Tutorials
These are a few simple tutorials for getting you up and running with SolarFarmer's web API.
These tutorials use the Python scripting language (see https://www.python.org/). You can call the web API using any language you like as long as it supports calls to web APIs.
The SolarFarmer web API has various endpoints (see https://en.wikipedia.org/wiki/Web_API for background information on web APIs). Each
tutorial will focus on one endpoint. The ModelChain
endpoint is the one that is used for running energy calculations.
Requirements for tutorials
You will need a personal API token to use the SolarFarmer web API. See Acquiring your Web API Token for more information on acquiring your API token.
You will also need to install and set up a Python environment on your machine. See Setting up a Python Environment for more information on this.
About
endpoint tutorial
Start with this simple tutorial. It uses the About
endpoint of the API to return details about the API version.
It will help you make sure that your API token is working and that you have access to the web API.
SolarPosition
endpoint tutorial
Another simple tutorial. It uses the SolarPosition
endpoint to use the API to calculate the solar position
using the latitude, longitude, elevation and time input parameters that you provide.
ModelChain
endpoint tutorial
This is the endpoint used to run synchronous energy calculations - use it for 2D calculations. In this tutorial you will run a 2D calculation.
ModelChainAsync
endpoint tutorial
This is the endpoint used to run asynchronous energy calculations - use it for 3D calculations and more complex 2D calculations. In this tutorial you will run a 3D calculation.
Service
endpoint tutorial
This uses the Service
endpoint to return the API services that the user has access to. Use this tutorial to list
the services that you have available to you.
TerminateModelChainAsync
endpoint tutorial
This is the endpoint to use to terminate a calculation that was started using the ModelChainAsync
endpoint.
In this tutorial you will terminate a 3D calculation that is already running.