We are thrilled to announce a REST API and a command line interface (CLI) for your MicroProfile Starter service that has been available since February 2019.
This has been a feature requested by MicroProfile developers since MicroProfile Starter’s inception so that they can access the Starter from a command line. This API will also be used by the upcoming extension for Visual Studio Code as well as planned extensions for Eclipse Che, IntelliJ IDEA, and Netbeans.
Why do you need this API?
- CLI, it enables developers to generate applications with curl or PowerShell, without the distraction of opening a web browser
- Tools integration, we open the service for other parties to integrate MicroProfile applications generation into Integrated Development Environments (IDEs) and tools
How to use the MicroProfile Starter CLI
The easiest way to generate a project is to pick a server and let the service select the latest MicroProfile version with all its specs enabled by default:
$ curl -O -J 'https://start.microprofile.io/api/project?supportedServer=THORNTAIL_V2' curl: Saved to filename 'demo.zip'
Shell session recording
Curl example was recorded as a text so as you can directly copy-paste from the video window. It shows how to list available options and pick servers and specs such as:
$ curl -O -J 'https://start.microprofile.io/api/project?supportedServer=PAYARA_MICRO&selectedSpecs=JWT_AUTH&selectedSpecs=METRICS'
Windows PowerShell session
Recorded video tutorial demonstrates how one can use PowerShell to generate a MicroProfile project:
Invoke-WebRequest -OutFile project.zip -Uri https://start.microprofile.io/api/project?supportedServer=TOMEE Expand-Archive ./project.zip
Noteworthy resources for selecting other servers and specifications are:
$ curl https://start.microprofile.io/api/mpVersion
$ curl https://start.microprofile.io/api/mpVersion/MP22
Documentation
Up-to-date documentation and examples for the API are kept in the project’s repository REST-README.md file. You can also access the documentation from the command line as follows:
$ curl https://start.microprofile.io/api/
In addition, formal specification is available on Swagger hub. When no API version is specified, the latest one is selected by default, e.g. start.microprofile.io/api/ is equivalent to start.microprofile.io/api/1/. Windows users have a number of options, including curl for Windows and PowerShell.
Advanced usage
The API allows you to POST JSON files instead of providing query parameters to your curl commands. It also enables you and your code to use Etag response header and If-None-Match request header so as you can avoid downloading the same zip files and parsing the same JSON responses again and again. Examples of Etag/If-None-Match usage and POST JSON cases are available in the documentation. Last but not least, the API offers resources more suitable for integration with tools and IDEs. These resources return the whole matrix of valid options in a one HTTP response as a big JSON.
Call to action
Watch this space for the upcoming VSCode extension for the MicroProfile Starter. In addition, the MicroProfile community is looking for volunteers for the design and implementation of extension for other IDEs, such as Eclipse Che, IntelliJ IDEA, and Netbeans. Please comment on issue 170 if volunteering for IntelliJ, 171 for Eclipse Che, and 174 for Netbeans.