REST Manager API
The XAP Manager provides the REST Manager API for managing the XAP environment.
Getting started is easy:
- Start a standalone Manager on your machine using the following command:
- After the Manager has started, Browse to localhost:8090 and start playing with the API.
Starting a manager is required to access the REST Manager API. You can also start a cluster of managers to ensure high availability. To learn more about the manager, refer to XAP Manager.
The REST Manager API was built with Swagger . Swagger provides typical information for each operation (parameters, responses, etc.). In addition, you can experiment with it by setting parameters and clicking the
Try it out! button from within the documentation. The operation will be invoked, and you’ll see the response code and body, as well as the
curl command and request URL which were used to invoke the command. If you are familiar with the older Admin API, most of this will be self explanatory. You can also download the
yaml specification and use Swagger’s
Online Editor to generate a client in your favourite language.
Long Running Operations
In the Admin API, long running operations (e.g. deploy, undeploy, etc.) are asynchronous with no future or callback. You can either track progress manually, or use various ‘andWait’ overloads (e.g. deployAndWait). In the REST API we cannot use andWait, so you need to poll for completion, but each such operation behaves differently. What we’ve done is added the notion of Request - each long running operation creates a request and returns its id, so you can poll on the request id and check it’s status (running/successful/failed). The request exposes additional useful information:
- Who started the request (ip and user)
- When was the request started and completed
- If the request failed, an error message
- Additional properties on the request execution
By default, the system keeps up to 100,000 completed requests (configurable), and purges the oldest as needed.
PU Deployment and Upload
Deploying a PU requires uploading a resource (jar/war/zip) to the manager, but due to technical issues we currently can’t include both binary file and json payload in the same REST operation. Instead, there are two operations:
- Upload a resource
- Deploy a PU, and provide a name of a previously uploaded resource.
This also means that when you undeploy a PU, the resource does not get deleted - if you want to delete it you need to execute a separate REST operation to delete it (if you want to undeploy/redeploy with the same JAR - there’s no need to remove it). Currently you cannot delete/replace a JAR file if there’s a deployed PU using it - in the future we’ll introduce support for hot-updating a PU and we’ll use that concept as the API.
Security needs to be explicitly enabled. As with any other
grid component, to enable the security add the system property
-Dcom.gs.security.enabled=true. For more information, see the Security Guide. By default, to get you up and running, if nothing was configured, the fallback security implementation uses a local file to save credentials (see File-Based Security.
When security is enabled, the REST API performs basic authentication and checks if the user has sufficient privileges to execute the operation.
Basic authentication does not encrypt user credentials, so running a manager in a secure environment without SSL is a security hazard; the system detects this and aborts. You must explicitly enable or disable the SSL by setting the system property
You can either:
- Disable SSL explicitly (not recommended)
- Enable SSL - the system will generate a certificate for you
- Enable SSL and provide a trusted certificate you own
An auto-generated certificate provides reasonable security, but if your enterprise security guidelines are more strict you’re welcome to provide your own certificate.
Finally, if you need to configure something which we don’t expose (we’re using Jetty under the hood to host the web app), you can provide your own jetty.xml file via a system property.
|Enable/disable||com.gs.manager.rest.ssl.enabled||must be explicitly set|
The following host operations are available :
For details on request parameters and url see your local Manager page: Host Operations
For details on request parameters and url see your local Manager page: Container Operations
For details on request parameters and url see your local Manager page: Space Operations
For details on request parameters and url see your local Manager page: Deployment Operations
For details on request parameters and url see your local Manager page: Request Operations
For details on request parameters and url see your local Manager page: Information Operations
For details on request parameters and url see your local Manager page: Spark
From the Swagger UI you generate client code in your favorite language: