Blame view

php/rest/getStatus.php 1.18 KB
e5ab198f   Nathanael Jourdane   simple getStatus
1
2
3
<?php

/**
d8f6b7eb   Nathanaël Jourdane   Add API documenta...
4
5
6
7
 * @api {get} getStatus.php getStatus
 * @apiDescription Get the current status of the request according to a process ID.
 * @apiName getStatus
 * @apiGroup webservices
e5ab198f   Nathanael Jourdane   simple getStatus
8
 *
d8f6b7eb   Nathanaël Jourdane   Add API documenta...
9
10
11
12
13
 * @apiParam {String} id process ID.
 *
 * @apiSuccess {String} success `true`
 * @apiSuccess {String} [dataFileURLs] URLs of results data files. If no URLs - no data for required parameters.
 * @apiSuccess {String} [plotURL] URLs of results plot files. If no URLs - no data for required parameters.
6185ceeb   Myriam Bouchemit   update for apidoc
14
 * @apiSuccess {String} [status] The status code. Possible values: "in progress, done, error".
d8f6b7eb   Nathanaël Jourdane   Add API documenta...
15
16
17
 *
 * @apiSuccessExample Success-Response:
 *     HTTP/1.1 200 OK
0cb6a7aa   Myriam Bouchemit   add info for apidoc
18
 *     {"success":true,"status":"in progress"} or
6185ceeb   Myriam Bouchemit   update for apidoc
19
 *     {"success":true,"status":"done","dataFileURLs":"http://amda.irap.omp.eu/AMDA/data/WSRESULT/getparameter_c1_hia_dens_20010923T090000_20130924T130000.txt"}
d8f6b7eb   Nathanaël Jourdane   Add API documenta...
20
 *
ddedb507   Myriam Bouchemit   layout for apidoc
21
 * @apiErrorExample Error-Response:
d8f6b7eb   Nathanaël Jourdane   Add API documenta...
22
 *     {"success":false,"message":"You must provide a job id"}
e5ab198f   Nathanael Jourdane   simple getStatus
23
 */
e5ab198f   Nathanael Jourdane   simple getStatus
24

9b69cb35   Nathanael Jourdane   Implement batch m...
25
require_once '../config.php';
e5ab198f   Nathanael Jourdane   simple getStatus
26

9b69cb35   Nathanael Jourdane   Implement batch m...
27
if (!key_exists("id", $_GET)) {
c8dd7875   Elena.Budnik   correct input data
28
	$result = array('success' => false, 'message' => "You must provide a job id");
9b69cb35   Nathanael Jourdane   Implement batch m...
29
30
} else {
	$amda_ws = new WebServer();
c8dd7875   Elena.Budnik   correct input data
31
	$result = $amda_ws->getStatus($_GET);
9b69cb35   Nathanael Jourdane   Implement batch m...
32
}
d8f6b7eb   Nathanaël Jourdane   Add API documenta...
33
echo json_encode($result);