getAvailability
is intended to people who need to know the
availability of the SsODNet service.
HTTP Request
getAvailability
service in your application. This can be done by using the web service method or
by using the following HTTP request:
- https://ssp.imcce.fr/webservices/ssodnet/api/getAvailability.php?[parameters]
&
.
The allowed parameters are:
Parameter | Definition | Limits |
---|---|---|
-mime=<string> |
Mime type of the results | votable | html | text | json |
-from=<string> |
Word which define the name of the caller application, or which describes the request |
any short string (no space character) |
The output results are described below, and are available
in VOTable (default), HTML, plain text format, and
JSON object (cf. examples). The -mime
argument
is optionnal and its value can be omitted (just write nothing or ...&-mime=
without value).
In this case, the output is displayed as VOTable.
Web service
getAvailability
method:
- Web Service URI:
- https://ssp.imcce.fr/webservices/ssodnet/ssodnet.php
- Namespace:
- https://ssp.imcce.fr/webservices/ssodnet
- WSDL:
- https://ssp.imcce.fr/webservices/ssodnet/ssodnet.php?wsdl
- SOAP header:
- name of the SOAP header element:
clientID
- SOAP header's content:
array('from' => 'YourName', 'hostip'=>'')
- Method:
- getavailability (inputArray)
Variable | Type | Units | Limits or values | Default | Comment |
---|---|---|---|---|---|
mime |
string | - | votable | html | text | json | votable | Mime type of the results |
The output of the getavailability
method is an object containing the following attributes:
- 'flag'
- the status of the response:
flag=1
means ok;flag=0
orflag=-1
mean that an error occured - 'status'
- the HTTP status-code of the response (e.g.
400: bad request
,422: Unprocessable Entity
,500: internal error
) - 'ticket'
- the Unix timestamp of the response which can be useful to stamp the request
- 'result'
- a string containing the ephemeris of the requested solar system bodies.
- votable
- the data are written in the IVOA standard VOTable format
- html
- the data are transformed from VOTable to HTML by XSLT processing (SsODNet XSL style sheet)
- text
- the data are returned in plain text where each value is separated by the pipe '|' character
- json
- the data are written in a JSON object.
Query examples
Output results
The output parameters of the method is a string which contains information which are conformed to the "availability 0.2" schema (IVOA Support Interfaces and Basic Profile):
No. | Definition | Value |
---|---|---|
1 | Availability | 'available', 'unavailable' |
2 | Uptime: time since last restart of service | duration |
3 | ValidTo: next scheduled down-time, if known, nil=true if unknown | dateTime (ISO format) |
4 | ContactDetails: detailed contact | string |
Structure of the output JSON object
{ "availability": {}, "uptime": {}, "validto": {}, "contact": {} }
How to consume
curl
or wget
.
For that, just execute one of the following commands in a console:
$> curl "<URL>"
or
$> wget "<URL>"
where <URL>
is described in section HTTP request.
In order to help you to invoke the SsODNet web service, we provide some clients
written in differents languages. Here are some detailed explanations to write a client with PHP
and SOAP which invokes the getAvailability
method:
1/ Provide the input parameters which are mandatory for the service:
// Client's ID: provide the name of your project or organisation or yourself
$from = 'MyName';
// Input parameters
$param = array('mime' => "text");
2/ Define the SOAP options, the namespace and the WSDL URI of SsODNet web service:
// Enables or disables the WSDL caching feature
ini_set('soap.wsdl_cache_enabled', 1);
// SkyBoT namespace
$namespace = 'https://ssp.imcce.fr/webservices/ssodnet';
// SkyBoT WSDL
$uriwsdl = $namespace.'/ssodnet.wsdl';
3/ Create a SoapClient object in WSDL mode, set the SOAP header, then call the method and catch exceptions:
try {
// Constructs the client
$client = new SoapClient($uriwsdl, array('exceptions'=>1));
// SOAP header
$header = array('from'=>$from, 'hostip'=>'', 'lang'=>'en');
$client->__setSoapHeaders(array(new SOAPHeader($namespace, 'clientID', $header)));
// Call the resolver method
$response = $client->__soapCall('getAvailability',$param);
// Display the results
if ($param['mime'] == 'text') {
header("HTTP/1.0 200");
header("Content-Type: text/plain");
$res = explode(';', $response);
$nbr = count($res);
$newkey = array_keys($res);
for ($i=0; $i<$nbr; $i++) { echo $res[$newkey[$i]].PHP_EOL; }
} else if ($param['mime'] == 'json') {
header("HTTP/1.0 200");
header("Content-Type: application/json");
echo $response;
} else {
header("HTTP/1.0 200");
header("Content-Type: text/xml;content=x-votable");
echo $response->result;
}
}
catch (SoapFault $fault)
{
trigger_error("SOAP Fault: {$fault->getTraceAsString()} (faultcode: {$fault->faultcode},
faultstring: {$fault->faultstring})", E_USER_ERROR);
}