-
Notifications
You must be signed in to change notification settings - Fork 21
WebServiceAPI
This document outlines the web service API for the DAISY Pipeline.
RESTful web services describe a system in terms of its resources. Generally speaking, resources can be created, retrieved, modified, and deleted.
The main resources in this web service are scripts, jobs, clients and data-types.
A script is a Pipeline XProc script. The script is identified with a unique URI. It is described in terms of its functionality and all of its inputs and options.
A job is the execution of a script. Jobs have unique IDs and are created using input and option values. Jobs produce downloadable results.
A client is an application using the Pipeline via its API. Examples of clients are web applications and command line utilities. A client is not a human user.
A data type determines the possible values a script option can take. It is defined in an XML syntax (a subset of RelaxNG).
RESTful applications communicate via HTTP and use standard methods and status codes to create, get, and delete resources.
The following HTTP methods are used here:
GET
POST
PUT
DELETE
Every method is not implemented for every resource because in some cases, the method wouldn't be relevant. Any unimplemented methods will respond with HTTP 405 "Method Not Allowed".
- HTTP Method:
GET
- URI:
/alive
- Response(s):
-
HTTP 200 OK
: Response body contains XML data. See a sample response document.
-
- HTTP Method:
GET
- URI:
/scripts
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 200 OK
: Response body contains XML data. See a sample response document. -
HTTP 401 Unauthorized
: Client was not authorized to perform request.
-
- HTTP Method:
GET
- URI:
/scripts/$ID
- Where $ID is the script's ID
- Query parameters
- See Authentication
- Response(s):
-
HTTP 200 OK
: Response body contains XML data. See a sample response document. -
HTTP 401 Unauthorized
: Client was not authorized to perform request. -
HTTP 404 Not Found
: Resource not found
-
- HTTP Method:
POST
- URI:
/jobs
- Query parameters:
- See Authentication
- Request body:
- Response(s):
-
HTTP 201 Created
: Response body contains XML data about the new resource. See a sample document. -
HTTP 400 Bad Request
: The request was invalid -
HTTP 401 Unauthorized
: Client was not authorized to perform request.
-
Read more about creating jobs.
- HTTP Method:
GET
- URI:
/jobs
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 200 OK
: Response body contains XML data. See a sample response document. -
HTTP 401 Unauthorized
: Client was not authorized to perform request.
-
- HTTP Method:
GET
- URI:
/jobs/$ID
- Where $ID is the job's unique ID
- Query parameters:
-
msgSeq
(optional): Returned job status messages will be a subset of messages where the sequence values are greater than that provided. The default is 0. This parameter allows incremental reporting on job status; i.e. "only return messages newer than X". - See Authentication
-
- Response(s):
-
HTTP 200 OK
: Response body contains XML data. See a sample response document. -
HTTP 401 Unauthorized
: Client was not authorized to perform request. -
HTTP 404 Not Found
: Resource not found
-
- HTTP Method:
DELETE
- URI:
/jobs/$ID
- Where $ID is the job's unique ID
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 204 No Content
: Successfully processed the request, no content being returned -
HTTP 401 Unauthorized
: Client was not authorized to perform request. -
HTTP 404 Not Found
: Resource not found
-
- HTTP Method:
GET
- URI:
/jobs/$ID/result[/$TYPE/$NAME[/idx/$IDX]]
- Where $ID is the job's unique ID
- $TYPE is whether port or option
- $NAME is the port or option name
- $IDX is the index of a single output within the port/option.
- An example of a result description in the job xml format.
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 200 OK
: Response body contains Zip data -
HTTP 401 Unauthorized
: Client was not authorized to perform request. -
HTTP 404 Not Found
: Resource not found
-
- HTTP Method:
GET
- URI:
/jobs/$ID/log
- Where $ID is the job's unique ID
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 200 OK
: Response body contains a plain text representation of the log file -
HTTP 401 Unauthorized
: Client was not authorized to perform request. -
HTTP 404 Not Found
: Resource not found
-
- HTTP Method:
GET
- URI:
/datatypes
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 200 OK
: Response body contains XML data. Thedatatypes
root element has ahref
attribute, and adatatype
child for every existing data type. Eachdatatype
element has ahref
atrtibute and anid
attribute containing the data type's unique ID. -
HTTP 401 Unauthorized
: Client was not authorized to perform request.
-
- HTTP Method:
GET
- URI:
/datatypes/$ID
- Where $ID is the data type's unique ID
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 200 OK
: Response body contains the definition of the data type in XML. -
HTTP 401 Unauthorized
: Client was not authorized to perform request. -
HTTP 404 Not Found
: Resource not found
-
In addition to managing scripts and jobs, the web service also
provides an administrative interface. Use of this API is restricted
to use by authorized clients; i.e. those with ADMIN
permissions.
- HTTP Method:
GET
- URI:
/admin/halt/$KEY
- Where $KEY is generated by the web service upon startup and stored locally as a text file.
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 204 No Content
: Successfully processed the request, no content being returned -
HTTP 401 Unauthorized
: Client was not authorized to perform request. -
HTTP 403 Forbidden
: The service could not be halted. This error would be caused by an invalid key.
-
- HTTP Method:
GET
- URI:
/admin/clients
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 200 OK
: Response body contains XML data. See a sample response document. -
HTTP 401 Unauthorized
: Client was not authorized to perform request. -
HTTP 404 Not Found
: Resource not found
-
- HTTP Method:
POST
- URI:
/admin/clients
- Query parameters:
- See Authentication
- Request body:
- Client XML. See a sample
- Response(s):
-
HTTP 201 Created
: Response body contains XML data about the new resource. See a sample document. -
HTTP 400 Bad Request
: The request was invalid -
HTTP 401 Unauthorized
: Client was not authorized to perform request.
-
- HTTP Method:
GET
- URI:
/admin/clients/$ID
- Where $ID is the client's unique ID
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 200 OK
: Response body contains XML data. See a sample response document. -
HTTP 401 Unauthorized
: Client was not authorized to perform request. -
HTTP 404 Not Found
: Resource not found
-
- HTTP Method:
DELETE
- URI:
/admin/clients/$ID
- Where $ID is the client's unique ID
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 204 No Content
: Successfully processed the request, no content being returned -
HTTP 401 Unauthorized
: Client was not authorized to perform request. -
HTTP 404 Not Found
: Resource not found
-
- HTTP Method:
PUT
- URI:
/admin/clients/$ID
- Where $ID is the client's unique ID
- Query parameters:
- See Authentication
- Response(s):
-
HTTP 200 OK
: Response body contains XML data about the modified resource. See a sample response document. -
HTTP 400 Bad Request
: The request was invalid -
HTTP 401 Unauthorized
: Client was not authorized to perform request. -
HTTP 404 Not Found
: Resource not found
-
Schema for all the XML formats used in this API can be found here.
When authentication is enabled, the Pipeline only accepts requests from authorized clients. In order to become authorized, a client must be added to the database of clients using the admin API described in [#Admin].
The client must add the following query parameters to each request:
-
authid
: Identifies the client application -
time
: Timestamp (UTC) -
nonce
: A unique string generated by the client -
sign
: Hash of the URI string including all query params except this one
Note that it is possible to start the web service with authentication disabled. This is appropriate when the web service is running only locally or in other similarly controlled environments. In this case, none of the authentication parameters are required, and any that are sent are ignored.
Read more about authentication.
The web service is by default run in what is referred to as local FS
mode. The property org.daisy.pipeline.ws.localfs
must be set to
change it. In local mode, the web service assumes read/write access to
the disk. Documents that would normally be sent as part of a zip
archive or inline request can be referred to by their local file path
instead. Output options are enabled and output is written to disk
instead of being zipped up for download.
See a sample document.
In the unlikely but not impossible case that the Pipeline WS suffered from an internal error, a descriptive xml is returned along with the HTTP 500 header.
See the xml sample document.
- Home
- Download
-
Help
-
User Guide
- Installation
- Desktop Application
- Web Application
- Pipeline as a Service
- Command Line
-
Scripts
- DAISY 2.02 Validator
- DAISY 2.02 to EPUB 3
- DAISY 3 to DAISY 2.02
- DAISY 3 to EPUB 3
- DTBook Validator
- DTBook to DAISY 3
- DTBook to EPUB3
- DTBook to HTML
- DTBook to ODT
- DTBook to PEF
- DTBook to RTF
- DTBook to ZedAI
- EPUB 2 to EPUB 3
- EPUB 3 Enhancer
- EPUB 3 Validator
- EPUB 3 to DAISY 2.02
- EPUB 3 to DAISY 3
- EPUB 3 to PEF
- EPUB to DAISY
- HTML to DTBook
- HTML to EPUB3
- HTML to PEF
- NIMAS Fileset Validator
- ZedAI to EPUB 3
- ZedAI to HTML
- ZedAI to PEF
- API Documentation
- Issue Tracker
- Troubleshooting
- Forum
- [[Contact|mailto:[email protected]]]
-
User Guide
- Contribute
- DAISY Home