REST Web Services
webPDF provides its interfaces as REST web services in accordance with the "Java Specification Request (JSR) 311" (https://jsr311.java.net/). This manner of provision is based on the web standards and the HTTP protocol.
The webPDF functions are provided as REST (Representational State Transfer) resources and can be addressed via a Uniform Resource Identifier (URI). The resources are displayed in JSON (http://www.json.org/).
The webPDF server provides the REST web services on the basis of JAX-RS 2.0 (https://jax-rs-spec.java.net/) and the Jersey reference implementation (https://jersey.java.net/).
The different URIs of the web services can be executed via the HTTP methods PUT, GET, POST and DELETE.
All together this forms the webPDF REST API, which is generally described under "REST Webservice API" and technically under "API {REST}".
Documentation as OpenAPI
The documentation is provided automatically as OpenAPI. For automated processing or import into developer tools or frameworks, it can also be retrieved directly as a JSON or YAML structure:
JSON: http://localhost:8080/webPDF/rest/openapi.json
YAML: http://localhost:8080/webPDF/rest/openapi.yaml
URI of the web services
All URI have the shared base URL
/webPDF/rest
After this comes the URL segment for the respective web service, followed by further segments which are specific to the web service. An overview of the web services provided with their base URI is shown below:
| Web service | URI | API documentation |
|---|---|---|
| Converter | /webPDF/rest/converter/... | API {REST} |
| Signature | /webPDF/rest/signature/... | API {REST} |
| Pdfa | /webPDF/rest/pdfa/... | API {REST} |
| Toolbox | /webPDF/rest/toolbox/... | API {REST} |
| URLConverter | /webPDF/rest/urlconverter/... | API {REST} |
| OCR | /webPDF/rest/ocr/... | API {REST} |
| Barcode | /webPDF/rest/barcode/... | API {REST} |
Apart from these, there are two URI which serve the purposes of document administration ("documents” web service) and login ("authentication” web service).
Web service call examples
Converts the document with ID "2f32abfc05594f42bb89128a4052817d" to a PDF document using the "Converter" web service
POST http://localhost:8080/webPDF/rest/converter/2f32abfc05594f42bb89128a4052817d
Reads the information for the currently logged in user.
GET http://localhost:8080/webPDF/rest/authentication/user/info
Reads the list of files that are currently served for the session on the server.
GET http://localhost:8080/webPDF/rest/documents/list
Parameters for controlling the web services
For the REST web services, the parameters are passed in JSON structures found in the request’s "Request Body" (e.g., POST).
When calling a REST web services endpoint, set the Content-Type header to the application/json value.