Skip to content

Coding for product REST APIs

Rusiri Illesinghe edited this page Jun 27, 2025 · 2 revisions

Structure of the components involved in the implementation

Client is the source where the invocations to the API is made; for example :Consider the API Manager UI. Within the carbon-apimgt source code you will meet the Implementation for product REST APIs and corresponding backend implementation.

REST API Best Practices

Code structure for REST APIs (carbon-apimgt)

Following is a code structure for REST APIs provided by the WSO2 API Manager. In each component which exposes a REST API, there's a .yaml file containing its' definition. Whenever you need to make modifications to the product REST APIs this is the place you should change as the first step. REST API Best Practices (1)

After doing the required code changes to the yaml file, build the carbon-apimgt repository to generate code.

Overall coding flow at the REST API level

Following is the overall coding flow at the REST API level REST API Best Practices (4)

Role of the dependencies involved in the code generation - JAX-RS with Apache CXF

Screenshot 2025-06-27 at 20 49 13

jaxrs-cxf-cdi : Generates a Java JAXRS Server according to JAXRS 2.0 specification, assuming an Apache CXF runtime and a Java EE runtime with CDI enabled.

JAX-RS : A Java EE specification about creating RESTful APIs in Java Enterprise applications.

Apache CXF : An opensource web services framework which supports multiple types of APIs such as JAX-RS (REST) etc.

Following Java class represents a sample usage of JAX-RS annotations :

Screenshot 2025-06-27 at 20 59 05

Clone this wiki locally