getObsDataTree.php 1.3 KB
<?php
  
/**
 * @api {get} getObsDataTree.php getObsDataTree
 * @apiDescription Provides the hierarchy of public access data in AMDA.
 * @apiName getObsDataTree
 * @apiGroup webservices
 * 
 * @apiParam {String} [userID] Identifier of the user in AMDA (*mandatory for user owned data*)
 * @apiParam {String} [password] Password of the user in AMDA (*mandatory for user owned data*)
 * @apiParam {Boolean} [templateInfo] `1` to include info about templated parameters - Default `0`.
 *
 * @apiSuccess {String} success true.
 * @apiSuccess {String} workspace URL of the XML file containing the list of "public" parameters in AMDA.
 *
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
 *     [success] => 1
 *         [WorkSpace] => stdClass Object
 *      (
 *          [LocalDataBaseParameters] => http://amda.irap.omp.eu/AMDA/data/WSRESULT/obsdatatree_impex_20180919_AmdaLocalDataBaseParameters.xml
 *      )
 *
 *
 * @apiErrorExample Error-Response:
 *     {"error":"No Amda Local DataBase Parameters description file"}
 */

  require_once '../config.php';

  $amda_ws = new WebServer();
  $result = $amda_ws->getObsDataTree($_GET);

   if ($result['WorkSpace']){
      foreach($result['WorkSpace'] as $key => $value) {
	echo "<$key>$value</$key>";
      }
    }
    else {
      echo $result['message']; 
    }
?>