A public API for PV modeling parameters.
Browsing to pvfree.azurewebsites.net/api/v1/pvinverter/?format=json
will display a JSON string with the first 20 records. The endpoint and query string to obtain
the next set api/v1/pvinverter/?limit=20&offset=20
is contained in the next
key of the string as are the endpoints for each inverter. Note: the query string ?format=json
is only necessary when using the API directly in a browser to display the response. Other formats like XML and
YAML can also be used. When submitting requests, the default format will be JSON but can be changed in the header,
i.e.: Accept: application/xml
. Use the links in the navigation bar at the top of the page to view human readable, searchable,
sortable tables of the API resources in the database.
PV Free is tested on every commit to the master branch on Travis-CI.
pvfree is moving to Microsoft Azure Cloud b/c Heroku free dyno service will end Nov 28th. Please use https://pvfree.azurewebsites.net/ from now on to get module and inverter parameters for pvlib and to learn about solar energy modeling.
The API offers CRUD list and detail operations for the following resources:
API | Endpoint |
---|---|
CEC/Sandia Inverters | /api/v1/pvinverter/ |
Sandia Modules | /api/v1/pvmodule/ |
CEC Modules | /api/v1/cecmodule/ |
The parameter schemas are determined by the models in PVLIB.
The API is generated by the Tastypie
Django extension. Add the following endpoints to the base URL,
https://pvfree.azurewebsites.net/
:
api/v1/pvinverter/
api/v1/pvinverter/1/
api/v1/pvinverter/set/2;3;5;10/
api/v1/pvinverter/?limit=100&offset=500
api/v1/pvinverter/schema/
Python has several libraries for interacting with URLs. The Requests package is available from PyPI.
>>> import requests
>>> response = requests.get('https://pvfree.azurewebsites.net/api/v1/pvinverter/set/1;3;5/')
>>> response
<Response [200]>
>>> response.status_code
200
>>> response.content
{"objects": [{"C0": -2.48104842861e-05, "C1": -9.0149429405099999e-05, "C2": 0.00066889632690700005, "C3": -0.018880466688599998, "Idcmax": 10.0, "Mppt_high": 50.0, "Mppt_low": 20.0, "Paco": 250.0, "Pdco": 259.52205054799998, "Pnt": 0.02, "Pso": 1.7716142241299999, "Vac": 208.0, "Vdcmax": 65.0, "Vdco": 40.242603174599999, "id": 1, "Name": "MICRO-0.25-I-OUTD-US-208", "resource_uri": "/api/v1/pvinverter/1/"}, ...]}
Use cURL from the command line.
$ curl -H "Accept: application/json" https://pvfree.azurewebsites.net/api/v1/pvinverter/
{"meta": {"limit": 20, "next": "/api/v1/pvinverter/?limit=20&offset=20", "offset": 0, "previous": null, "total_count": 1742}, "objects": [{"C0": -2.48104842861e-05, "C1": -9.0149429405099999e-05, "C2": 0.00066889632690700005, "C3": -0.018880466688599998, "Idcmax": 10.0, "Mppt_high": 50.0, "Mppt_low": 20.0, "Paco": 250.0, "Pdco": 259.52205054799998, "Pnt": 0.02, "Pso": 1.7716142241299999, "Vac": 208.0, "Vdcmax": 65.0, "Vdco": 40.242603174599999, "id": 1, "Name": "MICRO-0.25-I-OUTD-US-208", "resource_uri": "/api/v1/pvinverter/1/"}, ...]}
The following fields can be filtered using Django
ORM. Add the query strings to the API base URL, api/pvinverter
. Note: use encoded
URI components for the following reserved query string characters: for "&"
use
"%26", for "+" use "%2B", for "?"
use "%3F" and for "=" use "%3D".
Name
iexact
, istartswith
, icontains
, iregex
, iendswith
?Name__iregex=^Power[- ]One
Vac
exact
, lt
, lte
, gt
, gte
?Vac__gt=200&Vaco__lte=300
Contribute to PV Free on GitHub.