Commit 7b25cb5335dad4981fcdde1eeacc3a5eb782adde
1 parent
f3e98005
Exists in
master
and in
9 other branches
hapi : status : object
Showing
3 changed files
with
8 additions
and
14 deletions
Show diff stats
src/DDSERVICES/HAPI/capabilities.php
... | ... | @@ -2,8 +2,7 @@ |
2 | 2 | |
3 | 3 | $response = array(); |
4 | 4 | $response["HAPI"] = "2.0"; |
5 | - $response["status"] = 1200; | |
6 | - $response["msg"] = "ok"; | |
5 | + $response["status"] = array("code" => 1200, "msg" => "OK"); | |
7 | 6 | $response["outputFormats"] = array("csv"); |
8 | 7 | |
9 | 8 | header('Content-Type: application/json'); | ... | ... |
src/DDSERVICES/HAPI/catalog.php
src/DDSERVICES/HAPI/info.php
... | ... | @@ -12,9 +12,10 @@ |
12 | 12 | |
13 | 13 | $response = array(); |
14 | 14 | $response["HAPI"] = "2.0"; |
15 | + header('Content-Type: application/json'); | |
15 | 16 | |
16 | 17 | if (!$_GET["id"]) { |
17 | - $response["status"] = 400; | |
18 | + $response["status"] = 404; | |
18 | 19 | $response["msg"] = "No ID !!!"; |
19 | 20 | |
20 | 21 | exit(json_encode($response)); |
... | ... | @@ -27,10 +28,8 @@ |
27 | 28 | |
28 | 29 | $xmlName = $files[0]; |
29 | 30 | |
30 | - if (!file_exists($xmlName)) { | |
31 | - $response["status"] = 400; | |
32 | - $response["msg"] = "No such SPASE DESC !!!"; | |
33 | - | |
31 | + if (!file_exists($xmlName)) {; | |
32 | + $response["status"] = array("code" => 1406, "message" => "NO SUCH ID"); | |
34 | 33 | exit(json_encode($response)); |
35 | 34 | } |
36 | 35 | |
... | ... | @@ -41,8 +40,7 @@ |
41 | 40 | |
42 | 41 | $parameters = $dataset->getElementsByTagName('Parameter'); |
43 | 42 | if ( $parameters->length == 0 ) { |
44 | - $response["status"] = 400; | |
45 | - $response["msg"] = "No Parameters !!!"; | |
43 | + $response["status"] = array("code" => 404, "msg" => "NO PARAMETERS"); | |
46 | 44 | exit(json_encode($response)); |
47 | 45 | } |
48 | 46 | |
... | ... | @@ -70,9 +68,7 @@ |
70 | 68 | $response["stop"] = $dataset->getElementsByTagName('StopDate')->item(0)->nodeValue; |
71 | 69 | $response["cadence"] = $dataset->getElementsByTagName('Cadence')->item(0)->nodeValue; |
72 | 70 | $response["parameters"] = $parametersResponse; |
73 | - $response["status"] = 1200; | |
74 | - $response["msg"] = "OK"; | |
71 | + $response["status"] = array("code" => 1200, "msg" => "OK"); | |
75 | 72 | |
76 | - header('Content-Type: application/json'); | |
77 | 73 | exit(json_encode($response)); |
78 | 74 | ?> |
79 | 75 | \ No newline at end of file | ... | ... |