Implementing an operation in a REST API
Use the REST API Editor in the Application Development view to implement operations in a REST API.
Before you begin
- Create a REST API in the IBM® Integration Toolkit, as described in Creating a REST API.
- If you created the REST API from scratch by defining resources, models, and operations (as described in Creating a REST API from scratch by using the IBM Integration Toolkit, you must also define the operations in the REST API Editor. For information about how to do this, see Defining resources, models, and operations in a REST API.
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 has not been implemented, an HTTP 501 Not Implemented status code is returned to the client.
To implement an operation in a REST API, complete the following steps:
- Open the REST API that contains the operation that you
want to implement. The REST API Editor is in the Application Development view under the REST API project.
- Locate the operation in the REST API Editor. Operations are listed under the Operations heading, and are grouped by resource.
- The Header section shows the details for the REST API base URL.
- The Resources section shows the
operations for each resource. Click this button to create a subflow for the operation:. If you have already defined a subflow for the operation, that subflow is opened. When you click this button, you are prompted to confirm that you want to save the REST API; this 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.
Use the hover-help that is provided for each button to get information about the associated action.
- Implement the operation by adding any of the standard IBM Integration Bus 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.
What to do next
- 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.
- 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.