Closed corviday closed 7 months ago
A demo is available at https://services.pacificclimate.org/dev/pcex/api/
Sample curl commands for testing:
# a POST request
curl -X POST 127.0.0.1:8000/api/timeseries -F 'id_=cdd_sClimMean_BCCAQv2_PCIC12_historical-rcp85_rXi1p1_19610101-19901231_Canada' -F 'area=""' -F 'variable=cdd'
# identical GET request
curl "http://127.0.0.1:8000/api/timeseries?id_=cdd_sClimMean_BCCAQv2_PCIC12_historical-rcp85_rXi1p1_19610101-19901231_Canada&area=&variable=cdd"
Updates the backend to accept HTTP
POST
requests in addition to HTTPGET
. This is a straightforward update thanks to Flask's handyrequest.values
attribute, which contains all parameters supplied either in the URL of aPOST
or the body of aGET
, allowing the request methods to be treated identically.The goal here is to be able to accept longer
area
strings, especially from user-selected regions, such as when a user clicks on a point in a flow network to select all grid squares upstream of that point. One notable example of selecting an upstream area along the FRASER river results in anarea
string ten thousand characters long, too long to send in a URL.resolves #227