Hop Server JSON API
Next to the XML web services, Hop Server exposes a JSON API. It covers everything the XML services do for execution information, adds metadata and plugin registry access, and speaks JSON in both directions.
The base URL
The API is served by Hop Server itself, under /hop/api/v1/:
http://<hostname>:<port>/hop/api/v1/
It is available in the same two deployments as the rest of Hop Server: the standalone hop-server process, and the Hop Web war deployed in a servlet container.
| Before Hop 2.20 this API was a separate |
Authentication
The JSON API sits behind the same authentication as every other Hop Server endpoint, which is enabled by default. Requests without valid credentials are rejected with an HTTP 401.
curl --user cluster:cluster http://localhost:8081/hop/api/v1/metadata/types Error responses
Errors are reported as JSON with an appropriate status code:
{"error": "Unable to find web service 'test'"} | Status | Meaning |
|---|---|
| The request itself was wrong: a missing or invalid parameter, or a body that could not be parsed. |
| No or invalid credentials. |
| The requested path, or the element it names, does not exist. |
| The path exists but not for this HTTP method. |
| The element exists but is disabled. |
| The request body is not in a content type this endpoint accepts. |
| The request failed on the server. |
Failures which do not come from Hop itself are reported generically, with the detail written to the server log only. A stack trace is never sent to the client.
Metadata services
| Method | Path | Description |
|---|---|---|
|
| List all the metadata type keys. |
|
| List the names of all the elements of a type. |
|
| Get one metadata element, serialized exactly as it is on the filesystem. |
|
| Save a metadata element, posted as JSON. Returns the name of the element that was saved. |
|
| Delete a metadata element. Returns the name of the element that was deleted. |
curl --user cluster:cluster http://localhost:8081/hop/api/v1/metadata/list/pipeline-run-configuration ["local"] Plugin services
| Method | Path | Description |
|---|---|---|
|
| List all the plugin type class names in the registry. |
|
| List all the plugins for a plugin type. Only class names present in the registry are accepted. |
Execution services
| Method | Path | Description |
|---|---|---|
|
| Run a Web Service synchronously and stream its output back. |
The body to post can contain the following options:
-
service: the name of the Web Service metadata element to use -
runConfig: the pipeline run configuration to use, overriding the one on the web service -
variables: a map of variables (or parameters) with their names and values -
bodyContent: set as a variable using the body content variable option on the Web Service metadata
curl -X POST --user cluster:cluster \
http://localhost:8081/hop/api/v1/execute/sync \
-H 'Content-Type: application/json' \
-d '{ "service" : "test", "runConfig" : "local", "variables" : { "VAR1" : "value1" } }' The response body is the concatenation of the values of the output field, for every row written by the transform configured on the Web Service metadata element, streamed as the pipeline produces them. The response content type is the one configured on that element, text/plain when it is left empty.
This endpoint runs exactly the same code as hop/webService, so the body and header content variables, binary output fields and the status listing option all behave identically.
| The one option which is not honoured here is the Web Service status code field. JAX-RS fixes the response status before the body is streamed, so a pipeline which has to drive the HTTP status must be called through |
Asynchronous web services are not executed here: use hop/asyncRun and hop/asyncStatus, described in Asynchronous Web Service.
Execution information location services
These operate on an Execution Information Location metadata element, named by {location} in the paths below. They are the JSON equivalent of the hop/getExecInfo and hop/registerExecInfo services and cover the same operations.
| Method | Path | Description |
|---|---|---|
|
| List execution IDs. |
|
| Register an execution, posted as JSON. |
|
| Find the last execution of a given type and name. |
|
| Get one execution. |
|
| Delete one execution. |
|
| Get the execution state. |
|
| Update the execution state, posted as JSON. |
|
| Get the logging text of the execution state. |
|
| Find the child executions of a parent execution. |
|
| Find the child execution IDs of a given type. |
|
| Find the parent execution ID. |
|
| Get the execution data. |
|
| Register execution data, posted as JSON. |
curl --user cluster:cluster \
'http://localhost:8081/hop/api/v1/location/local/executions?children=true&limit=100' ["af84cbc2-0166-4dea-956f-72b73cf66d0d","bf84cbc2-0166-4dea-956f-72b73cf66d0e"]