Client applications submit a request to the LightWave Server process using a specially crafted HTTP URI, HTTP Method, and HTTP Request Body. The HTTP URI indicates the API being invoked and the NonStop system resource that the request should act upon. The URI may also include additional parameter values necessary to complete the request. The HTTP Method indicates the operation being performed on the resource. The optional HTTP Request Body and Request Headers contain data and/or parameters necessary to complete the request. After processing the request, LightWave Serverreturns an HTTP Response Status with an optional HTTP Response Body and Response Headers. Each combination of Method, URI, and parameters is referred to as an operation, and groups of operations are organized into APIs.
User-defined APIs are a powerful feature of LightWave Server that allow you to design your own RESTful interface to your NonStop Server applications. With a user-defined API, you dictate the form of the URI and the query parameters and HTTP headers your API will use. You can map those elements to fields in the interprocess message which is sent to your application server. Likewise, you can define how replies from the server are mapped to the response that your API client receives. User-defined APIs allow you to hide the details of your server interface from users of your API.
LightWave Server also support a set of predefined native APIs that provide raw access to underlying NonStop Kernel resource. These APIs are used in conjunction with User-defined APIs. The following native APIs are provided:
- Dialog API - Manage Pathway serverclass dialogs
- Transaction API - Begin, end, and abort TMF transactions. These transactions may also be used with other APIs to enlist those operations in a transaction.
Some examples of API access using Method and URI combinations is shown below:
|GET||/systemstatus/v1/cpu||Use a user-defined API to get CPU status information from a Pathway server.|
|POST||/employee||Use a user-defined API to send a request to the employee server to create a new employee. The employee information is contained in the JSON request body.|
|POST||/lightwave/api/v1/transaction?timeout=30||Use the Native transaction API to begin a new transaction with a 30 second autoabort timeout. A transaction ID is returned in the response and may be used in subsequent User-defined API requests to enlist that request in the transaction.|