This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Generating SDKs

Software Development Kits (SDKs) contain the necessary toolkits to create a client application to invoke a particular API. If an API consumer wants to create an application, they can generate a server stub or client side SDK for a supported language/framework and use it to write a software application to consume the subscribed APIs.

SDK generation is not supported with the APIs that are created using OpenAPI 3.0 support.

Generating client SDKs in the API Store

Tip: A valid API subscription must exist in order to use the SDK. SDK generation is allowed per API. 

By default, SDK generation is enabled for Java and Android. If those two languages are sufficient, move to step 3. To enable SDK generation for other languages, 

  1. Open the <APIM_Home>/repository/conf/api-mamanger.xml file and edit the <SupportedLanguages> property of the <SwaggerCodegen> element to include any of the supported languages/frameworks. An example is shown below,

        <SwaggerCodegen>
            <ClientGeneration>
                <GroupId>org.wso2</GroupId>
                <ArtifactId>org.wso2.client.</ArtifactId>
                <ModelPackage>org.wso2.client.model.</ModelPackage>
                <ApiPackage>org.wso2.client.api.</ApiPackage>
                <!-- Configure supported languages/Frameworks as comma separated values,
                 Supported Languages/Frameworks : android, java, scala, csharp, cpp, dart, flash, go, groovy, javascript, jmeter,
                 nodejs, perl, php, python, ruby, swift, clojure, aspNet5, asyncScala, spring, csharpDotNet2, haskell-->
                <SupportedLanguages>java,android,ruby,php</SupportedLanguages>
            </ClientGeneration>
        </SwaggerCodegen>


    In this example, the supported languages are defined as Java, Android, Ruby and PHP. 

  2. Once the above configuration is saved, start the API Manager server. 
  3. Log in to the API Store, open the API and click the SDKs tab. Download options are available for each programming language specified earlier in the api-manager.xml file.

  4. Download the SDK for the preferred language and use it to write software applications to consume the API.

    Tip: Make sure that you are logged in to the API Store before attempting to download the SDK. As mentioned above, a valid subscription should exist for the API. The SDK cannot be used without a valid access token for the subscription.

Generating server stubs and client SDKs in the API Publisher

The API Publisher has an embedded swagger editor with the ability to generate server code and client SDKs then and there.  

Client SDK and Server Stub generation in API Publisher is only supported for Rest APIs.


  1. Open an existing API and choose to edit it. 
  2. Click Edit Source to open the embedded swagger editor.
  3. To generate and download a server stub, click Generate Server and select a server stub from the list.
    API deveopers can use the Generate Server option to generate the REST API structure based on the swagger definition. The actual backend implementation can be developed on top of the code generated using swagger code generator. You can select from a list of frameworks to generate the actual backend implementation stub of the REST API.
  4. To generate and download a client SDK, click Generate Client and select a client from the list.

The generated server stubs and client SDKs are generated using Swagger Codegen. 

It is recommended to add the securityDefinitions in the swagger definition to be able to pass access tokens when invoking an API. Edit the source of the API from the API Publisher and add the code given below.

securityDefinitions:
  default:
    type: oauth2
    authorizationUrl: 'https://<GW-HOST>:<GW-PORT>/authorize'
    flow: implicit
    scopes: {}
security:
  - default: []