B. Using a UWS

In this part the usability of UWS will be described through an example: the UWS Timers. Its URL is http://cdsportal.u-strasbg.fr/uwstuto/basic. It manages only one JobList named timers. A HTML form to interact with this UWS is available at http://cdsportal.u-strasbg.fr/uwstuto/3.0/basic.html. With this form you can easily manipulate the URL, the HTTP method and the parameters, so that you can experiment yourself the different types of request.

So, now, let's see the basic operations of a UWS !

1. List jobs

To list all the jobs of a JobList you only have to select the web resource associated with the JobList. Here you just have to type in your browser the URL:

http://cdsportal.u-strasbg.fr/uwstuto/basic/timers

2. Create a job

To create a job you just need to send a HTTP-POST request to the JobList. No parameter is required, but if you want you can give one of the following:

The JobID must be generated automatically so that it can identify only one job in the whole jobs list.

Once created the response to the request must be a redirection to the summary of the Job, that is to say: an HTTP code 303 ("See other") and the URL http://cdsportal.u-strasbg.fr/uwstuto/basic/timers/12345 (supposing the created job has the ID 12345). If the parameter PHASE has been given with the value RUN, the Job must start directly.

3. Get a job summary

As said previously UWS is a service based on REST. That means that any resource is available thanks to a URI build in a hierarchical manner. To get a job summary, you need to know the URL of the UWS, the name of the JobList and the ID of the job:

UWS_URL+"/"+JobList_name+"/"+Job_ID.

So you get the following URL: http://cdsportal.u-strasbg.fr/uwstuto/basic/timers/12345.

Note 1: The other resources

All other objects which compose a Job object are available in the same way:

Note 2: The error summary case

An ErrorSummary object is represented with 3 main pieces of information: The detailed message must be available at the URI /{jobs}/(job-id)/error (in our example the corresponding URL is http://cdsportal.u-strasbg.fr/uwstuto/basic/timers/12345/error).

4. Change some job parameters

Some job parameters are writable. That means the client can change their value by sending a HTTP-POST request to the URL of the job parameter to change. The request must have exactly one parameter whose the key must be the name of the parameter to change. The response will always be a redirection to the job summary.

For example: To change the parameter Execution Duration you must send a request to http://cdsportal.u-strasbg.fr/uwstuto/basic/timers/12345/executionduration with the parameter EXECUTIONDURATION=120 (for 120 seconds). The response will be a redirection to http://cdsportal.u-strasbg.fr/uwstuto/basic/timers/12345.

Additional parameters must be updated in a different way. A HTTP-POST request must be sent to the URI /{jobs}/(job-id)/parameters with one key-value pair which associates the name of the parameter and its value. An alternative is to send a HTTP-PUT request with the same parameter but at the following URI /{jobs}/(job-id)/parameters/{paramName}.

Warning:

The value of a writable parameter can be changed ONLY IF the job has not been yet executed !

5. Start a job

Starting a job implies sending a HTTP-POST request to the job phase with the parameter PHASE=RUN. In this case the execution phase of the Job goes from PENDING to QUEUED when the server starts to execute the Job, and finally to EXECUTING when the execution finishes successfully.

6. Abort a job

Aborting a job implies sending a HTTP-POST request to the job phase with the parameter PHASE=ABORT. In this case the execution must finished and the execution phase must be set to ABORT.

7. Destroy a job

There are two possible ways to remove a job from a jobs list:

When receiving one of these two request the Job execution must abort, all resources associated with the Job (result file, error file, ...) must be deleted and finally the Job must be removed from its JobList. The response to these requests is a redirection to the JobList: http://cdsportal.u-strasbg.fr/uwstuto/basic/timers.

8. Important notes