Define REST API
After defining the REST API Endpoint Group worksheet, we use the same example Create Customer to define the REST API. Each AlchemyJ workbook can only support one ##RESTAPI worksheet.
- Go to ##RESTAPI, key in the values as shown below for the Basic Settings. These settings define the name for API and package. In this sample, the generated jar file would be called CustomerService.jar.
Property | Value |
---|---|
API name | CustomerService |
Package name | alchemydemo.customer |
Version | 1.0.0 |
- Next, we will need to define the worksheet name of Endpoint Groups included in this API which is the one we have set up earlier.
Endpoint group Definition Sheets |
---|
##RestEndpointGroup |
Default values have been set to Runtime Configuration and Build-and-Run Web Server Configuration sections. You can modify the value if needed.
Specify the DB connection information in Data Source Configuration section which will be used for executing the REST API on the server. Also, the Data Source in the AlchemyJ Properties need to be set up to preview the function in AlchemyJ studio.
Now, all formulas and settings have been defined. We will preview the API in AlchemyJ Studio. Go to the AlchemyJ toolbar, click Run Function Point and select Create Customer to test the function point in AlchemyJ Studio.
The result can be found in C12 and DB. The model works as expected.