Implementing an operation for REST APIs based on OpenAPI 3.0 documents
Use the REST API Editor in the Application Development view or the OpenAPI Editor to implement operations in a REST API.
Before you begin
- Create a REST API based on an OpenAPI 3.0 specification document in the IBM® App Connect Enterprise Toolkit, as described in Creating a REST API.
- If you created the REST API from scratch, as described in Creating a REST API from scratch with OpenAPI 3.0 specifications by using the IBM App Connect Enterprise Toolkit, you must also define the resources, models, and operations in the OpenAPI editor . For more information, see Defining resources, models, and operations in a REST API by using the OpenAPI editor.
About this task
If you do not implement an operation, you can still deploy the REST API to an integration server. However, when an HTTP client attempts to call an operation that is not implemented, an HTTP 501 Not Implemented status code is returned to the client.
You can use the OpenAPI Editor to create, edit, and delete subflows for operations for OpenAPI 3.0 based REST APIs.
Procedure
To implement an operation in a REST API, complete the following steps:
- Open the REST API Description by double-clicking the REST API project or by
right-clicking and selecting Open. The REST API editor for OpenAPI 3.0 documents opens and provides a view of the API details, its Resources and Operations, Error handling, Security, and Message Validation Settings.
- In the RESTPI Editor, open the REST API that contains the operation that you want to implement.
- In the REST API Editor for OpenAPI 3.0, locate the
operation in the Resources and Operations section and click Create
Subflow. Alternatively, if you are working with the REST API in the OpenAPI editor , locate the operation and click Create
Subflow.
The new subflow is opened. You are prompted to confirm that you want to save the REST API. Saving the RESTAPI ensures that the nodes that you add to the subflow are correctly defined with the current definition of the REST API. The subflow is opened in the Message Flow Editor, and it is brought to the front. If you already created a subflow, the actions Edit Subflow and Delete Subflow are provided instead of Create Subflow.
- Implement the operation by adding any of the standard IBM App Connect Enterprise message flow nodes to the subflow.
For more information, see Implementing a REST API operation by using a message map.
- Access the REST API operation information, REST API operation parameters, and REST API request and response body, as described in Implementing REST API operation processing in the subflow by using message flow nodes.
Results
What to do next
You can also complete the following optional tasks:
- Implement error handling for the REST API as a set of subflows. For more information, see Implementing an error handler in a REST API.
- Secure your REST API by using HTTPS for encrypting communications between client and server. For more information, see Securing a REST API by using HTTPS.
- Secure your REST API by authenticating users with HTTP Basic Authentication. For more information, see Securing a REST API by using HTTP Basic Authentication.
- If your REST API is going to be used by client-side code that is running in a web browser, you might have to configure Cross-Origin Resource Sharing, as described in Permitting web browsers to access a REST API by using Cross-Origin Resource Sharing.
- You can enable JSON Validation for your REST API by using the "Message Validation" settings in the ACE REST API Editor. For more information about JSON Validation, see JSON validation.
- REST APIs are configured by default to handle JSON data. If you want to handle non-JSON data, see Handling non-JSON data in a REST API.