= Web services for remote job submission =
This document describes remote interfaces for remotely submitting jobs and batches of jobs
to a BOINC server.
The APIs are accessed by sending a POST request,
using HTTPS, to PROJECT_URL/job_control.php
The inputs and outputs of each API are XML documents.
If an operation fails, the output is of the form
{{{
   X
}}}
where X is an error message.
All operations include the authenticator of the user making the request.
This user must be marked as a "job submitter" in the BOINC database.
== Describing a batch ==
A job is described by
{{{
   [C]
   [URL or path]
   ... other input files
}}}
Each input file is specified by either a URL accessible to the server,
or by a path on the server.
A batch of jobs is described by:
{{{
   appname
   [x]
   [x]
   ...
   ... more jobs
}}}
The names of the input and output template files may be specified;
otherwise the defaults '''appname_in''' and '''appname_out''' are used.
== Batch runtime estimation ==
Estimates the completion time of a batch.
Input:
{{{
   X
    ... 
   [N]
}}}
'''Priority''', if specified, is relative to other batches submitted by this user.
Output:
{{{
   X
}}}
== Submitting a batch ==
Input:
{{{
   X
    ... 
   [N]
}}}
Output:
{{{
N
}}}
== Querying jobs ==
The jobs in a batch are numbered starting from 0.
The name of a job is '''batch_ID_N'''
where ID is the batch ID and N is the number of the job.
Input:
{{{
   X
   X
}}}
Output:
{{{
   
   or
   
      
      or
      N
      M
      X
      X
   
   ... other instances
}}}
== Querying batches ==
Input:
{{{
   X
   N
}}}
Output:
{{{
   X
   N
   X
}}}
== Aborting jobs ==
Input:
{{{
   X
   N
}}}
Output:
{{{
}}}
== Example usage ==
PHP:
{{{
$ch = curl_init("http://project.edu/job_control.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURL_POSTFIELDS, "
   
      
         myappname
         
             --t ALPHA
         
      
   
");
$reply = curl_exec($ch);
$r = new SimpleXMLElement($reply);
curl_close($ch);
if ($r->estimate) {
   echo "Estimate: $r->estimate->seconds seconds\n";
} else {
   echo "Error: $r->error->message\n";
}
  
== Implementation notes ==