|
|
|
@ -55,7 +55,10 @@ class WfdAPI extends API {
@@ -55,7 +55,10 @@ class WfdAPI extends API {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getStationSamples($station_id) { |
|
|
|
|
$endpoint = "/coastal-trans-samples"; |
|
|
|
|
$endpoint = "coastal-trans-samples"; |
|
|
|
|
|
|
|
|
|
$this->headers["Authorization"] = "Bearer {$this->accessToken}"; |
|
|
|
|
$this->headers["Accept"] = "application/json"; |
|
|
|
|
$data = array( |
|
|
|
|
"coastalTransStationId.equals" => $station_id |
|
|
|
|
); |
|
|
|
@ -68,13 +71,21 @@ class WfdAPI extends API {
@@ -68,13 +71,21 @@ class WfdAPI extends API {
|
|
|
|
|
* Fetches data for a specific station according to the sample sampleIds |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public function getData($parameter_ids) { |
|
|
|
|
public function getData($parameter_ids, $data_category='all') { |
|
|
|
|
|
|
|
|
|
$this->headers["Authorization"] = "Bearer {$this->accessToken}"; |
|
|
|
|
$this->headers["Accept"] = "application/json"; |
|
|
|
|
$res = []; |
|
|
|
|
$data = array( |
|
|
|
|
"coastalTransSampleId.in" => implode(",", $parameter_ids) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$endpoint = "coastal-trans-abiotics"; |
|
|
|
|
$res = json_decode($this->get($endpoint, $data)); |
|
|
|
|
if ($data_category === 'all') |
|
|
|
|
$endpoints = array("coastal-trans-abiotics","coastal-trans-macrofaunas", "coastal-trans-phytoplanktons", "coastal-trans-angiosperms"); |
|
|
|
|
|
|
|
|
|
foreach ($endpoints as $endpoint) { |
|
|
|
|
array_push($res, json_decode($this->get($endpoint, $data))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $res; |
|
|
|
|
} |
|
|
|
|