Gloop REST APIs
Along with the ability to expose Gloop services via SOAP, Gloop also allows you to create RESTful APIs which can then be exposed to your API consumers using their automatically generated Swagger and OpenAPI definitions, as well as Postman collections.
The RESTful API functionality was built with the OpenAPI initiative in mind, so many parts and fields of the REST API editor are there to help generate the definitions. As a result, it's recommended to become familiar with the Swagger specification, as well as the OpenAPI specification.
For further assistance, TORO Integrate logs warning messages if it finds anything that it considers incorrect with the REST API, such as invalid data or empty fields that are required.
Creating a REST API
With TORO Integrate, you can create either a new RESTful web API from scratch or generate the services and the Gloop REST API, itself, from an existing definition. Either way, to create a new RESTful web API, you must do the following steps first:
Launch Coder's Gloop API wizard.
- Go to the Coder Navigator view.
- Right click on your target package's
codefolder or any of the code directories under it where you'd like your API to reside.
- Select New, then select Gloop API. The wizard should now appear in your screen.
Launch the wizard using keyboard shortcuts only
In Coder Studio, you can open the Gloop API wizard by pressing and by typing
apiin the appearing dialog's search box.
Select Publish as the type of action, then click Next.
Specify the name of the API and ensure New REST API is selected; then click Finish or Next again.
If you want to create a Gloop REST API from scratch but would like to enter the other meta-properties of your API later (such as its description, version, terms, and others), then you may now click Finish to proceed to opening the REST API editor. Otherwise2, click Next.
Creating a REST API From Scratch
To create a new and undefined Gloop REST API, continue using the wizard and follow the steps below:
- Choose None as the source, then click Next.
Enter the version, title, and license name onto their corresponding text boxes, then click Next. These will be displayed in the Swagger or OpenAPI definition.
The license text field has an 'auto-complete' feature that suggests commonly used licenses.
Enter the documentation URL and (optionally) add a description for it. Click Next.
Use Markdown in your description
Note that as per the specifications of OpenAPI and Swagger, the
descriptionfield allows CommonMark. Coder Studio also allows you to preview the markdown as you edit it. Beside the editor are six buttons. They are as follows:
- Source view
- Source and Preview view
- Preview view
- Orientation toggle (toggles the preview being beside or underneath the source while in the Source and Preview view
- Preview back
- Preview forward
Optionally, add any tags to the API, then click Next again.
- Optionally, enter the path that you would like to expose via REST. Click Next.
- Choose a service that you would like to add to the API, then click Next.
- Finally, choose the HTTP request method that the operation will map to, then click Finish.
At this point the Gloop REST API editor will open and display your newly created Gloop REST API's details:
How do I generate REST APIs from existing definitions?
The steps for generating Gloop services and Gloop APIs from existing definitions are discussed Generating Gloop Services. This guide does not cover the topic as it is already documented in the resource linked.